Experimental Physics and Industrial Control System
Kevin M. Peterson wrote:
I have a Linux IOC and I am using the main function from
R3.14.1's example App. After the IOC is initialized iocsh
left in "interactive mode" just like the App. Dev. Guide
describes.
Unfortunately, "shutting down" the Linux IOC dangerously
easy. It isn't necessary to type the "exit" command; Closing
the terminal window or pressing Ctrl-C do the job with even
less effort.
Is it possible to start the Linux IOC and have it run in the
background? The Linux IOC seems to be missing the
"non-interacting mode" that all of the vxWorks IOCs have.
I have written a small tcl program (see attachment), that acts as a box
for a shell (e.g. a Linux IOC) to run it in the background. Terminals
programs can connect via TCP-IP (e.g. telnet). When the shell dies, it
will be restarted automatically.
usage: shellbox.tcl <TCP-port> <shellcommand> &
It is a quick an simple tool, thus there is no security. Everyone can
log in and all input is merged to stdin of the shell. All stdout and
stderr is distributed to everyone who is logged in.
To make live easier, I have also written a script (iocsh, attached),
that creates a startup script on the fly from its command line arguments
and starts a Linux IOC. To use it, you will have to adjust the pathnames
in the script :-(
Best regards
Dirk
--
Dr. Dirk Zimoch
Swiss Light Source
Paul Scherrer Institut
Computing and Controls
phone +41 56 310 5182
fax +41 56 310 4413
Attachment:
shellbox.tcl
Description: Tcl script
#!/bin/bash
if [ "$1" = -h ]
then
echo "usage: iocsh [files]"
echo "start an EPICS iocsh and load files"
echo "recognized filetypes: *.db *.template *.subs *.dbd"
echo "after *.db and *.template, you can specify substitutions with macro=value"
echo "if a file is @filename, more arguments are read from filename"
echo "all other files are taken as scripts to source"
exit
fi
if [ "$1" = -v ]
then
echo "iocsh by Dirk Zimoch"
echo '$Source: /cvs/CVSROOT/UTILITIES/scripts/sh/iocsh,v $'
echo '$Revision: 1.5 $'
echo '$Date: 2002/12/19 08:55:23 $'
exit
fi
export LD_LIBRARY_PATH=/devl/epics3.14.0.beta1/base/lib/linux-x86:$LD_LIBRARY_PATH
startup=$(mktemp /tmp/iocstartup.XXXXXX)
function loadFiles () {
while [ "$#" -gt 0 ]
do
file=$1
case $file in
( @* ) loadFiles $(cat ${file#@}) ;;
( *.db | *.template) subst=""
while [ "$#" -gt 1 ]
do
case $2 in
( *=* ) subst="$subst,$2"; shift ;;
( * ) break ;;
esac
done
echo "dbLoadRecords (\"$file\", \"${subst#,}\")" ;;
( *.subs | *.subst ) echo "dbLoadTemplate (\"$file\")" ;;
( *.dbd ) echo "dbLoadDatabase (\"$file\")" ;;
( * ) echo "< $file" ;;
esac
shift
done
}
{
echo "dbLoadDatabase /devl/epics3.14.0.beta1/APPS/EPS/dbd/example.dbd"
echo "registerRecordDeviceDriver pdbbase"
loadFiles $*
echo "iocInit"
} >> $startup
trap "rm -f $startup" EXIT
softioc $startup 2>&1
- References:
- Running iocsh in the background Kevin M. Peterson
- Navigate by Date:
- Prev:
RE: Building VxWorks Boot Rom on Linux Singleton, SJ (Stephen)
- Next:
Re: Can't build the CMLOG under Tornado 2.0 for mv162, ppc etc. (fwd) Vladis Korobov
- 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: Running iocsh in the background John Maclean
- Next:
RE: Running iocsh in the background Rarback, Harvey
- 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