Experimental Physics and
| |||||||||||||||||
|
Kevin M. Peterson wrote:
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 #!/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
| ||||||||||||||||
ANJ, 10 Aug 2010 |
·
Home
·
News
·
About
·
Base
·
Modules
·
Extensions
·
Distributions
·
Download
·
· Search · EPICS V4 · IRMIS · Talk · Bugs · Documents · Links · Licensing · |