the epics brick is a linux-based softioc using a pc104 processor. it
employs the screen application as well and allows us to remotely connect
and interact with the iocshell. although the brick can boot under
different configurations (i.e. x, no-x, no-x serial), the ioc
application is still
started (at boot time) in the background under the screen application.
/david
Rod Nussbaumer wrote:
Eric Norum wrote:
I suggest that you run the IOC daemon within a detached screen
session. This is how we start our 'soft' IOCs here. It is useful
in that it allows you to connect to the screen session and interact
with the IOC console when needed.
As has already been pointed out, this only seems to make sense under
an OS such as Unix or similar.
For our IOCs running on Linux, we use an xterm running on an X virtual
frame buffer (Xvfb) to host the soft IOC. The xterm runs Gnu screen,
which silently runs bash, which runs the IOC. This is all launched
from rc.local at boot time, and can be done from a headless host.
Later, one can attach to the Gnu screen session, and see what is
happening, or enter iocshell commands. Under Gnu screen, one can even
use the 'stuff' command to control and monitor the session to some
extent. We have arranged a web interface that is capable of stopping
and restarting the IOC using such a mechanism.
The code in rc.local (could, maybe should be given it's own proper
startup script) looks like this:
#====================================< rc.local
>==========================================
SCREEN_EPICS="IBCS EPICS"
#
# We run the EPICS IOC inside of Gnu screen sessions, so
# we can monitor them and send commands to their interactive
shells. We need
# a way to create a tty for them at boot time. The Xvfb provides
a virtual X server
# to support an xterm that can in turn support a bash shell.
#
echo "Launching X virtual framebuffer"
Xvfb :1 -fbdir /tmp &
# We really should do something more robust for this...
echo "Snoozing while the virtual X server finds it's fonts..."
sleep 10
export DISPLAY="localhost:1"
echo "Starting EPICS IOC xterm/screen"
xterm -e screen -S "$SCREEN_EPICS" su -c bash bomr &
echo "Snoozing while bash initializes..."
sleep 10
#
# Q: So what is all this `echo -ne '\015'` stuff?
# A: We are stuffing characters into a Gnu screen session, and
# this is how we stuff a 'newline'
#
# Help prevent exiting the base shell. Disable the 'exit' command.
# We can still exit the shell manually by typing 'Ctlr-D'
#
echo "Disabling 'exit' in EPICS bash shell"
screen -S "$SCREEN_EPICS" -X stuff "alias exit=''"`echo -ne '\015'`
echo "Starting EPICS IOC"
screen -S "$SCREEN_EPICS" -X stuff "cd
/usr1/local/epics/appl/bacnet"`echo -ne '\015'`
screen -S "$SCREEN_EPICS" -X stuff "./startup.ibcs"`echo -ne '\015'`
# echo Done
#=================================================================================
We disable the bash 'exit' command to ruggedize the system against
accidental termination through the Web interface. Sending 'exit' twice
in a row will first exit the IOC, then exit bash, killing the entire
Gnu screen session.
On Jun 8, 2006, at 4:58 AM, Christophe Moins wrote:
Hello,
I would like to daemonize an ioc process but I have not managed to
do it till now.
I tried to implement the classical solution by using the fork and
setsid routines but then the readout is not correctly performed by
the ioc.
Is there a simple way to do it ?
Thanks
Christophe
--
+-------------------------------------------------+
David M. Kline [email protected]
Beamline Controls and Data Acquisition (BCDA)
Argonne National Laboratory, Advanced Photon Source
Argonne IL, 60439 630.252.8639
---------------------------------------------
Beamlines R Us
+-------------------------------------------------+
- References:
- ioc daemon Christophe Moins
- Re: ioc daemon Eric Norum
- Re: ioc daemon Rod Nussbaumer
- Navigate by Date:
- Prev:
Matlab MCA: arrays; maintain it; OSX Kay-Uwe Kasemir
- Next:
RE: Matlab MCA: arrays; maintain it; OSX Steven Banks
- Index:
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
<2006>
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
- Navigate by Thread:
- Prev:
Re: ioc daemon Rod Nussbaumer
- Next:
Re: ioc daemon J. Frederick Bartlett
- Index:
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
<2006>
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
|