CVSROOT: :ext:[<valid user>@]lxi001.gsi.de:/misc/hadesprojects/daq/cvsroot
module: EPICS/startupProcedures
bash, but rather dash since its the the least common denominator) on the systems
| softIOC and special IOCs | x86-based |
| hadcon and TRB | axis cris architecture |
procServ, a Process Server with Telnet Console and Log Access
procServ calling script startBackgroundEpicsIoc.sh
startBackgroundEpicsIOC.sh
usage: startBackgroundEpicsIOC.sh [options]
starts EPICS IOC in background using procServ tool,
which spawns and automatically respawns the ioc process
and makes it available via local telnet:
telnet localhost port
where port is set to default `4813'
options:
-w workingDir : EPICS IOC application dir / a.k.a. workingDir (absolute path)
[`/home/hadaq/EPICS/epics_apps/HadControlTemperatureAndThreshold']
-i iocBootdir : EPICS IOC iocboot dir
place where to change to and where log and pid files may be written (absolute path)
[`/home/hadaq/EPICS/epics_apps/HadControlTemperatureAndThreshold/iocBoot/iocHadControlTemperatureAndThreshold_linux-cris_v10']
-c command file : st.cmd file started relativ to `./'
if not absolute path, taken relatively to `EpicsIocBootDir'
[`st_linux-cris_v10.cmd']
-a commandArgs : [quoted list] of argument[s] for executable of ioc process,
[`""']
-P procServ exe : procServ executable
[`/home/hadaq/EPICS/startupProcedures/procServ/procServ']
-L procServ lib : procServ lib path needed to be added to LD_LIBRARY_PATH, multiple calls possible
[`/home/hadaq/EPICS/startupProcedures/procServ/lib']
-p port : telnet port [`4813'], see above
-t logport : set log readonly telnet port for active procServ access (NOTE: default log port will be port+1)
[`4814']
-g : activate file logging for procServ [OFF]
-G loggingDir : file logging directory,
if not absolute path, taken relatively to `workingDir' [`/home/hadaq/EPICS/epics_apps/HadControlTemperatureAndThreshold']
[`/home/hadaq/EPICS/epics_apps/HadControlTemperatureAndThreshold']
-D : debug mode of procServ [OFF]
-I name : name of (IOC) process
[`etrax047:4813_st_linux-cris_v10.cmd']
-o "options" : additional options for procServ
[`']
General:
-b baseHome : home directory of hadaq
[`/home/hadaq']
-n : no action, just echos command instead of executing the ioc process [OFF]
-d : debug mode of caller, sets set -xv [OFF]
-v : verbosity of caller, can be called repeatedly [OFF]
-e scriptname : helper script internally used by `startBackgroundEpicsIOC.sh' for checks
defaults to be searched in the same directory as \'startBackgroundEpicsIOC.sh'
[`./exitIfHelpers.sh']
-q : sets verbosity of caller off [OFF]
-h : this help
exitIfHelpers.sh used by the other scripts
lxg0434 (GSI network) and hadesdaq02 (HADES network)
cron and
scs the IOCs
~scs/procServ are called by cron at reboot
| machine | script | crontab -e / crontab -l | comments |
|---|---|---|---|
| hadesdaq02 | ioc-cave.sh |
@reboot cd ~scs/procServ/ && ./ioc-cave.sh |
requires settings for shared libraries |
| lxg0434 | ioc-hv.sh |
@reboot cd ~scs/procServ/ && ./ioc-hv.sh |
requires settings for shared libraries needs to be started at lxg0434 since since log files are on /scratch.local/ due to size |
| template | ioc-template.sh |
@reboot cd ~scs/procServ/ && ./ioc-template.sh |
template for further commands |
|
...
(Click to expand)
%begin bash%
#!/bin/bash
# ioc-
|
...
(Click to expand)
%begin bash%
#!/bin/bash
# ioc-hv.sh
# starts EPICS IOC in background using procServ tool
# by defining user specific variables
# and
# then calling/sourcing ${startBackgroundEpicsIocScript}
# which implements those settings
#
# Author: P.Zumbruch@gsi.de 12/01/2010
# Last modification: 23/02/2010
# uncomment to debug
#set -xv
scriptname=ioc-hv.sh
startBackgroundEpicsIocScriptName=startBackgroundEpicsIoc.sh
useUserDefinedVariables=yes
#specific predefines
userDefines()
{
userProcServTelnetPort=4813
#userProcServTelnetLogPort=4814
userIOC=ioc-hv-$(hostname);
userWorkingDir=~scs/epics_apps/prototypes/cbmall/iocBoot/ioccbm
userCommandExecutable="../../bin/linux-x86/cbmall";
userCommandArgument="st.cmd";
userProcServExecutable=$(which procServ)
userProcServDefaultExecutable=/u/epics/programs/bin/procServ
userLibraryPathAdd=/u/scs/epics_apps/prototypes/cbmall/cbmApp/src #several paths allowed, separated by colon ':'
[ 0 -ge "${userProcServTelnetLogPort}" ] && unset userProcServTelnetLogPort
userCommand="${userCommandExecutable} ${userCommandArgument}";
userProcServLoggingDir=${userWorkingDir}
userProcServExecutable=${userProcServExecutable:-${userProcServDefaultExecutable}}
}
#look for startBackgroundEpicsIocScriptName
startBackgroundEpicsIocScript=$(which $startBackgroundEpicsIocScriptName)
startBackgroundEpicsIocScript=${startBackgroundEpicsIocScript:-./${startBackgroundEpicsIocScriptName}}
#start script if available, else report ERROR and exit
if [ -f "${startBackgroundEpicsIocScript}" ]
then
. ${startBackgroundEpicsIocScript}
else
echo "$scriptname: ERROR could not find main script file \`$startBackgroundEpicsIocScriptName'"
exit -1
fi
%end%
|
...
(Click to expand)
%begin bash%
#!/bin/bash
# ioc-cave.sh
# starts EPICS IOC in background using procServ tool
# by defining user specific variables
# and
# then calling/sourcing ${startBackgroundEpicsIocScript}
# which implements those settings
#
# Author: P.Zumbruch@gsi.de 12/01/2010
# Last modification: 23/02/2010
# uncomment to debug
#set -xv
scriptname=ioc-cave.sh
startBackgroundEpicsIocScriptName=startBackgroundEpicsIoc.sh
useUserDefinedVariables=yes
#specific predefines
userDefines()
{
userProcServTelnetPort=4813
#userProcServTelnetLogPort=4814
userIOC=ioc-cave-$(hostname);
userWorkingDir=~scs/apps/hades/iocBoot/ioccave
userCommandExecutable="../../bin/linux-x86/hades";
userCommandArgument="st.cmd";
userProcServExecutable=$(which procServ)
userProcServDefaultExecutable=/usr/local/bin/procServ
userLibraryPathAdd=/home/scs/apps/hades/hadesApp/src #several paths allowed, separated by colon ':'
[ 0 -ge "${userProcServTelnetLogPort}" ] && unset userProcServTelnetLogPort
userCommand="${userCommandExecutable} ${userCommandArgument}";
userProcServLoggingDir=${userWorkingDir}
userProcServExecutable=${userProcServExecutable:-${userProcServDefaultExecutable}}
}
#look for startBackgroundEpicsIocScriptName
startBackgroundEpicsIocScript=$(which $startBackgroundEpicsIocScriptName)
startBackgroundEpicsIocScript=${startBackgroundEpicsIocScript:-./${startBackgroundEpicsIocScriptName}}
#start script if available, else report ERROR and exit
if [ -f "${startBackgroundEpicsIocScript}" ]
then
. ${startBackgroundEpicsIocScript}
else
echo "$scriptname: ERROR could not find main script file \`$startBackgroundEpicsIocScriptName'"
exit -1
fi
%end%
|
<ProcServ Default Executable>/procServ
<procServ Parent Dir, e.g. ~scs> cd <procServ Parent Dir>EPICS/startupProcedures/softIOC/procServ to <startup Procedues Dir, e.g. procServ> cvs -r -d :ext:[<valid user>@]lxi001.gsi.de:/misc/hadesprojects/daq/cvsroot checkout -d procServ EPICS/startupProcedures/softIOC/procServ wget -N https://wiki.gsi.de/pub/Epics/HowToSetupHadesIOCsRestartAtReboot/startupProcedures_softIOC.tar.gz &&
tar zxvf startupProcedures_softIOC.tar.gz <startup Procedues Dir, e.g. procServ> and change permissions on template and shell script files: cd <procServ Parent Dir>/<startup Procedues Dir, e.g. procServ> &&
chmod 775 ioc-template.sh && chmod a+x *.sh ioc-<myName>.sh: cd <procServ Parent Dir>/<startup Procedues Dir, e.g. procServ> &&
mv ioc-template.sh ioc-<myName>.sh <myName>: cd <procServ Parent Dir>/<startup Procedues Dir, e.g. procServ> &&
perl -pi -e 's/<Name>/<myName>/g' ioc-<myName>.sh ioc-<myName>.sh with an editor and change those values in '< ... >' myProcServExecutable is set automatically via which, it is possible that this doesn't work for cron. procServ, which is used if myProcServExecutable is empty or not set. <procServ Parent Dir>/procServ/ioc-<myName>.shprocServ: spawning daemon process: 17357, if not check your settings
telnet to your procServ session:
telnet localhost <Telnet Port> "^T" exit procServ session by typing "^Q" cron by using crontab
crontab -e @reboot cd <ABSOLUTE PATH: procServ Parent Dir>/procServ && ./ioc-<myName>.sh
leave the crontab editor and check result with
crontab -l cron job, you should temporarily add another line to cron:
crontab -e 30 19 * * * cd <ABSOLUTE PATH: procServ Parent Dir>/procServ && ./ioc-<myName>.sh
to start your job also at 19:30.
ps if your jobs are running:
ps x
PID TTY STAT TIME COMMAND
[...]
11097 ? S 0:00 <ProcServ Default Executable>/procServ --chdir <Working Directory> --logfile [...]
[...]
11101 pts/4 Ssl+ 2:21 <Command Executable> <Command Argument>
cron are reported typically via mail to the local mail system of your machine, try e.g. mail
cron job by using crontab crontab -e 30 19 * * * cd <ABSOLUTE PATH: procServ Parent Dir>/procServ && ./ioc-<myName>.sh
leave the crontab editor and check result with
crontab -l hadcon boards executes at startup/reboot the content of the /home/hadaq/etc/rc script file. procServ also here.
rc script resides on the mounted file system from lxhadesdaq and shows up on the local mount point /home/hadaq/etc/rc /var/diskless/etrax of lxhadesdaq, hadaq. /var/diskless/etrax since this is not in the backup :-/
<EPICS IOC (re)start script> is called/sourced from rc
rc script hostname the <EPICS IOC (re)start script> calls <EPICS IOC start Background script> which calls the corresponding EPICS IOC executable with its additional varying <Startup cmd Script> by using the functionalities of procServ <EPICS IOC (re)start script> should be called using a lookup table text file
IocListFile.txt
# IOC list file # # hostname | command exe | command arguments | telnet | telnet | logging directory | working dir a.k.a application dir | IOC boot directory | procServ exe | procServ libs | name | baseHome # | | | control | log | | | | | | | # | | | port | port | | | | | | | # # PZ etrax047 | st_linux-cris_v10.cmd | | 4813 | 4814 | | /home/hadaq/EPICS/epics_apps/HadControlTemperatureAndThreshold | iocBoot/iocHadControlTemperatureAndThreshold_linux-cris_v10 | etrax048 | st_linux-cris_v10.cmd | | 4813 | 4814 | | /home/hadaq/EPICS/epics_apps/HadControlTemperatureAndThreshold | iocBoot/iocHadControlTemperatureAndThreshold_linux-cris_v10 | # RPC LV #etrax105 | ... | | 4813 | 4814 | | ... #etrax106 | ... | | 4813 | 4814 | | ... #etrax107 | ... | | 4813 | 4814 | | ... #etrax108 | ... | | 4813 | 4814 | | ... #etrax109 | ... | | 4813 | 4814 | | ... #etrax110 | ... | | 4813 | 4814 | | ...
<EPICS IOC (re)start script> analyzes the lookup table or input options and selects depending on hostname<EPICS IOC start Background script> calls procServ with the embedding of the EPICS IOCrc
rc,
hostname export HOSTNAME=$(hostname) procServ installed /home/hadaq/procServ
/home/hadaq/EPICS/startupProcedures/procServ
/home/hadaq/EPICS/startupProcedures/procServ/lib
hadcons: <EPICS-IOCS>.txt /home/hadaq/EPICS/startupProcedures /home/hadaq/EPICS/startupProcedures
/home/hadaq/EPICS/startupProcedures script resetMACs.sh calling callee resetMAC.sh
/home/hadaq/EPICS/startupProcedures the procServ calling script startBackgroundEpicsIoc.sh
startBackgroundEpicsIOC.sh
usage: startBackgroundEpicsIOC.sh [options]
starts EPICS IOC in background using procServ tool,
which spawns and automatically respawns the ioc process
and makes it available via local telnet:
telnet localhost port
where port is set to default `4813'
options:
-w workingDir : EPICS IOC application dir / a.k.a. workingDir (absolute path)
[`/home/hadaq/EPICS/epics_apps/HadControlTemperatureAndThreshold']
-i iocBootdir : EPICS IOC iocboot dir
place where to change to and where log and pid files may be written (absolute path)
[`/home/hadaq/EPICS/epics_apps/HadControlTemperatureAndThreshold/iocBoot/iocHadControlTemperatureAndThreshold_linux-cris_v10']
-c command file : st.cmd file started relativ to `./'
if not absolute path, taken relatively to `EpicsIocBootDir'
[`st_linux-cris_v10.cmd']
-a commandArgs : [quoted list] of argument[s] for executable of ioc process,
[`""']
-P procServ exe : procServ executable
[`/home/hadaq/EPICS/startupProcedures/procServ/procServ']
-L procServ lib : procServ lib path needed to be added to LD_LIBRARY_PATH, multiple calls possible
[`/home/hadaq/EPICS/startupProcedures/procServ/lib']
-p port : telnet port [`4813'], see above
-t logport : set log readonly telnet port for active procServ access (NOTE: default log port will be port+1)
[`4814']
-g : activate file logging for procServ [OFF]
-G loggingDir : file logging directory,
if not absolute path, taken relatively to `workingDir' [`/home/hadaq/EPICS/epics_apps/HadControlTemperatureAndThreshold']
[`/home/hadaq/EPICS/epics_apps/HadControlTemperatureAndThreshold']
-D : debug mode of procServ [OFF]
-I name : name of (IOC) process
[`etrax047:4813_st_linux-cris_v10.cmd']
-o "options" : additional options for procServ
[`']
General:
-b baseHome : home directory of hadaq
[`/home/hadaq']
-n : no action, just echos command instead of executing the ioc process [OFF]
-d : debug mode of caller, sets set -xv [OFF]
-v : verbosity of caller, can be called repeatedly [OFF]
-e scriptname : helper script internally used by `startBackgroundEpicsIOC.sh' for checks
defaults to be searched in the same directory as \'startBackgroundEpicsIOC.sh'
[`./exitIfHelpers.sh']
-q : sets verbosity of caller off [OFF]
-h : this help
/home/hadaq/EPICS/startupProcedures script startEpicsIoc.sh calling callee startBackgroundEpicsIoc.sh
startEpicsIoc.sh
usage: startEpicsIoc.sh [options]
caller for script calling EPICS IOCs with procServ in "Background",
checks for matching hostnames with a given list of hostname,
or a file with a lookuptable to be evaluated
and calls the start script with the right argument
options:
Caller:
-H hostname : hostname
[`etrax047']
-s scriptname : background starting script's name (absolute path)
[`/home/hadaq/EPICS/startupProcedures/startBackgroundEpicsIoc.sh']
-e scriptname : helper script internally used by `startEpicsIoc.sh' for checks
defaults to be searched in the same directory as \'startEpicsIoc.sh'
[`./exitIfHelpers.sh']
-l list : quoted space separated list of hostnames, where an IOC should be started
[`"etrax047 etrax048"']
-m : allow several IOCs running [needs differing telnet ports to monitor/control]
[`"yes"']
-f file : file to retrieve hostnames, executables, dirs, arguments from,
overwrites all other relevant/default settings (absolute path)
[`iocListFile-Etrax.txt']
-S char : character separating the entries in the ioc list file
[`|']
Callee:
-w workingDir : place where log (default) and pid files may be written (absolute path)
[`']
-i iocBootDir : place where to change to IOC's boot directory,
if not absolute path, taken relatively to `workingDir'
[`']
-c commandExe : executable to be executed by callee,
if not absolute path, taken relatively to `workingDir'
[`']
-a commandArgs : [quoted list] of argument[s] for executable to be executed by callee,
[`""']
-A commandArgs : [quoted list] of [additional] argument[s] for callee,
[`""']
-I name : name to assign to the process (ioc) the callee starts
[automatically set by callee]
-g : activate file logging for procServ [OFF]
-G loggingDir : file logging directory,
if not absolute path, taken relatively to `workingDir' [`']
[`']
-p port : set telnet port for active procServ access, (NOTE: readonly port will be port+1)
[`4813']
-t logport : set log readonly telnet port for active procServ access (NOTE: default log port will be port+1)
[`']
-P procServExe : procServ executable
if not absolute path, taken relatively to `baseHome' [`/home/hadaq']
[`/home/hadaq/EPICS/startupProcedures/procServ/procServ']
-L : [list of colon ':' separated] shared library paths to be added
to LD_LIBRARY_PATH (may be called repeatedly)
[`/home/hadaq/EPICS/startupProcedures/procServ/lib']
General:
-b baseHome : home directory of hadaq
[`/home/hadaq']
-n : no caller action, just echos command instead of executing the caller [ON]
-N : no callee action, just echos command instead of executing the callee [OFF]
-d : debug mode of caller, sets set -xv [OFF]
-D : debug mode of callee, sets set -xv [OFF]
-v : verbosity of caller, can be called repeatedly [ON(2)]
-V : verbosity of callee, can be called repeatedly [OFF]
-q : sets verbosity of caller off [OFF]
-Q : sets verbosity of callee off [OFF]
-h : this help
/home/hadaq/EPICS/startupProcedures helper script exitIfHelpers.sh used by the other scripts
/home/hadaq/EPICS/startupProcedures lookup table file IocListFile.txt
# IOC list file # # hostname | command exe | command arguments | telnet | telnet | logging directory | working dir a.k.a application dir | IOC boot directory | procServ exe | procServ libs | name | baseHome # | | | control | log | | | | | | | # | | | port | port | | | | | | | # # PZ etrax047 | st_linux-cris_v10.cmd | | 4813 | 4814 | | /home/hadaq/EPICS/epics_apps/HadControlTemperatureAndThreshold | iocBoot/iocHadControlTemperatureAndThreshold_linux-cris_v10 | etrax048 | st_linux-cris_v10.cmd | | 4813 | 4814 | | /home/hadaq/EPICS/epics_apps/HadControlTemperatureAndThreshold | iocBoot/iocHadControlTemperatureAndThreshold_linux-cris_v10 | # RPC LV #etrax105 | ... | | 4813 | 4814 | | ... #etrax106 | ... | | 4813 | 4814 | | ... #etrax107 | ... | | 4813 | 4814 | | ... #etrax108 | ... | | 4813 | 4814 | | ... #etrax109 | ... | | 4813 | 4814 | | ... #etrax110 | ... | | 4813 | 4814 | | ...
/home/hadaq/etc to call the specific iocListFile
EPICS_startupProcedures_hadcon.tar.bz2 of all necessary startup directory structure and files in /home/hadaq/EPICS startBackgroundEpicsIOC.sh and ioc-template.sh | I | Attachment | Action | Size | Date | Who | Comment |
|---|---|---|---|---|---|---|
| |
EPICS_startupProcedures_hadcon.tar.bz2 | manage | 2 MB | 2010-02-11 - 17:56 | PeterZumbruch | Tar file: EPICS_startupProcedures_hadcon.tar.bz2 |
| |
startupProcedures_softIOC.tar.gz | manage | 6 K | 2010-03-03 - 14:10 | PeterZumbruch | Tar file: EPICS_startupProcedures_softIOC.tar.gz |
Copyright © by the contributing authors. All material on this collaboration platform is the property of the contributing authors. 