Skip to content
Snippets Groups Projects
Commit b321244d authored by Simon Rose's avatar Simon Rose
Browse files

Merge branch 'quieter_iocsh' into 'master'

E3-302: Quieter iocsh

See merge request e3/e3-require!28
parents 99df8673 baa44f5d
No related branches found
No related tags found
No related merge requests found
......@@ -4,6 +4,11 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
## [Unreleased]
## Bugfixes
* `iocsh.bash --help` (and variants) no longer loads tries to load `env.sh`.
## [3.4.1]
### Bugfixes
......
......@@ -15,9 +15,7 @@ E3_CONFIG_FILE := $(TOP)/tools/e3.cfg
E3_TEST_SCRIPT := $(TOP)/tools/test_installed_modules.sh
#
E3_SHELL_FILES := $(wildcard $(E3_MODULE_SRC_PATH)/tools/iocsh*.bash)
E3_IOC_CFG_FILES := $(E3_MODULE_SRC_PATH)/tools/iocsh_functions
E3_IOC_CFG_FILES += $(E3_ESSENVCFG_FILE)
#E3_IOC_CFG_FILES += $(E3_CONFIG_FILE)
E3_IOC_CFG_FILES += $(E3_MODULE_SRC_PATH)/tools/setE3Env.bash
E3_IOC_CFG_FILES += $(E3_MODULE_SRC_PATH)/tools/promptE3Env.bash
E3_REQUIRE_CONF_FILES := $(filter-out $(FILE_FILTER), $(wildcard $(TOP)/configure/modules/*))
......
#!/bin/bash
help () {
{
echo "Usage: iocsh [options] [files] [macro=value] ..."
echo "Start an EPICS iocsh and load files"
echo
echo "Options:"
echo " -?, -h, --help Show this page and exit."
echo " -v, --version Show version and exit."
echo " -32 Force 32 bit version (on 64 bit systems)."
echo " -x[.z[.y]] Select EPICS base version x.z.y (e.g. 3.14.8, 3.15, 7)."
echo " -d, --debug Run IOC with gdb."
echo " -dv Run IOC with valgrind."
echo " -dp Run IOC with perf record."
echo " -c 'cmd args' Ioc shell command."
echo " -s 'prog m=v' Sequencer program (and arguments), run with 'seq'."
echo " This forces an 'iocInit' before running the program."
echo " -r module[,ver] Modue (optionally with version) loaded via 'require'."
echo " -n name Name of the IOC, used for prompt and \${IOC} variable."
echo " Default: dirname if parent dir is \"ioc\" otherwise hostname."
echo " @file More arguments are read from file."
echo
echo "Supported filetypes:"
echo " *.db, *.dbt, *.template loaded via 'dbLoadRecords'"
echo " *.subs, *.subst loaded via 'dbLoadTemplate'"
echo " *.dbd loaded via 'dbLoadDatabase'"
echo " *.so loaded via 'dlload' (or 'ld' before 3.14.12)"
echo "All other files are executed as startup scripts by the EPICS shell."
echo "After a file you can specify substitutions like m1=v1 m2=v1 for that file."
echo
echo "Examples:"
echo " iocsh st.cmd"
echo " iocsh my_database.template P=XY M=3"
echo " iocsh -r my_module,version -c 'initModule()'"
echo " iocsh -3.15.4 -dp st.cmd"
echo " iocsh -c 'var requireDebug 1' st.cmd"
} >&2
exit
}
version () {
{
echo "iocsh by Dirk Zimoch"
} >&2
exit
}
# realpath and readlink are not available on all systems, let's try what works...
rp() {
( realpath $1 || readlink -f $1 || readlink $1 || (cd -P $1 && echo $PWD) || (x=$(\ls -ld $1) && echo ${x##* }) || echo $1 ) 2>/dev/null
}
# if EPICS_HOST_ARCH is not set guess it
if [ -z "$EPICS_HOST_ARCH" ]
then
EPICS_HOST_ARCH=$(basename $(dirname $(rp $(which caRepeater))))
if [ -n "$EPICS_HOST_ARCH" ]
then
echo "Guessing EPICS_HOST_ARCH=$EPICS_HOST_ARCH" >&2
else
echo "EPICS_HOST_ARCH is not set" >&2
exit 1
fi
fi
while true
do
case $1 in
( -32 )
EPICS_HOST_ARCH=${EPICS_HOST_ARCH%_64}
;;
( -[1-9]* )
unset EPICS_BASE
BASE=${1#-}
;;
( * ) break
;;
esac
shift
done
# Either EPICS or EPICS_BASE should be set to the install directory
if [ -z "$EPICS_BASE" ]
then
if [ -z "$EPICS" ]
then
# look for some standard install directories
for EPICS in /usr/local/epics /opt/epics /epics
do
if [ -d $EPICS ]
then
break
fi
done
if [ ! -d "$EPICS" ]
then
EPICS=$(dirname $(dirname $(dirname $(dirname $(ldd $(which caRepeater) | awk '/libca/ {print $3}')))))
echo "Guessing EPICS=$EPICS"
fi
if [ ! -d "$EPICS" ]
then
echo "Cannot find EPICS installation directory." >&2
echo "Try setting EPICS environment variable." >&2
exit 1
fi
fi
if [ -z "$BASE" ]
then
EPICS_BASE=$(\ls -1vrd $EPICS/base/bin/{${EPICS_HOST_ARCH},${EPICS_HOST_ARCH%_64}} 2>/dev/null | head -n1)
else
# find highest (requested) EPICS version that supports our architecture (or its 32 bit version)
EPICS_BASE=$(\ls -1vrd $EPICS/base-$BASE*/bin/{${EPICS_HOST_ARCH},${EPICS_HOST_ARCH%_64}} 2>/dev/null | head -n1)
fi
if [ -z $EPICS_BASE ]
then
if [ -z "$(\ls -1vrd $EPICS/base-$BASE*/ 2>/dev/null)" ]
then
echo "No EPICS $BASE installed." >&2
exit 1
fi
echo EPICS $BASE not available for EPICS_HOST_ARCH=$EPICS_HOST_ARCH. >&2
exit 1
fi
# maybe we need to change from 64 bit to 32 bit
if [ $EPICS_HOST_ARCH != ${EPICS_BASE#*/bin/} ]
then
EPICS_HOST_ARCH=${EPICS_BASE#*/bin/}
echo "No 64 bit version in ${EPICS_BASE%bin*}." >&2
echo "Switching to 32 bit version $EPICS_HOST_ARCH." >&2
fi
EPICS_BASE=$(rp ${EPICS_BASE%bin*})
fi
if [ ! -d $EPICS_BASE ]
then
echo "Cannot find EPICS_BASE directory." >&2
echo "Try setting EPICS_BASE environment variable to full path" >&2
exit 1
fi
# Get actual EPICS revision
if [ -f $EPICS_BASE/configure/CONFIG_BASE_VERSION ]
then
eval $(awk -F '[ \t]*=[ \t]*' '
/^[ \t]*EPICS_VERSION[ \t]*=/ {v=$2}
/^[ \t]*EPICS_REVISION[ \t]*=/ {r=$2}
/^[ \t]*EPICS_MODIFICATION[ \t]*=/ {m=$2+0}
END {print "BASE="v"."r"."m";BASECODE="v*10000+r*100+m}
' < $EPICS_BASE/configure/CONFIG_BASE_VERSION)
elif [ -f $EPICS_BASE/lib/$EPICS_HOST_ARCH/libCom.so ]
then
eval $(strings $EPICS_BASE/lib/$EPICS_HOST_ARCH/libCom.so | awk -F'[.R-]' '
/EPICS R[0-9]/ {print "BASE="$2"."$3"."$4";BASECODE="$2*10000+$3*100+$4 }')
else
echo "Cannot guess EPICS base version." >&2
exit 1;
fi
# IOC name derives from hostname
# (trailing possible '\r' under cygwin)
IOC=$(hostname|tr -d '\r')
# trailing possible domain name
IOC=${IOC%%.*}
# or get IOC name from start directory following PSI convention
if [ $(basename $(dirname $PWD)) = "ioc" ]
then
IOC=$(basename $PWD)
fi
export IOC
# Check for 64 bit versions, default to 32 bit
if [ ! -d $EPICS_BASE/lib/${EPICS_HOST_ARCH} -a -d $EPICS_BASE/lib/${EPICS_HOST_ARCH%_64} ]
then
echo "No 64 bit EPICS installation found. Defaulting to 32 bit" >&2
EPICS_HOST_ARCH=${EPICS_HOST_ARCH%_64}
fi
export EPICS_HOST_ARCH
# setup search path for require
ODIR=O.${BASE}_$EPICS_HOST_ARCH
EPICS_DRIVER_PATH=.:bin/$EPICS_HOST_ARCH:bin:snl:../snl:$ODIR:src/$ODIR:snl/$ODIR:../snl/$ODIR:${EPICS_DRIVER_PATH#:}
#Special PSI: find installation base for libs from working directory
D=$(rp $PWD)
I=${D%/iocBoot/*}
if [ $I != $D ]
then
INSTBASE=$I
fi
EPICS_DRIVER_PATH=${EPICS_DRIVER_PATH%:}:${EPICS_MODULES:=/ioc/modules}:${INSTBASE:=/work}/iocBoot/R$BASE/$EPICS_HOST_ARCH
export INSTBASE
# convert for win32-x86 arch
if [ ${EPICS_HOST_ARCH#win32-} != $EPICS_HOST_ARCH ]
then
EPICS_DRIVER_PATH=$(cygpath -wp $EPICS_DRIVER_PATH)
DBD=$(cygpath -wp $DBD)
fi
if [ ${EPICS_HOST_ARCH#cygwin-} != $EPICS_HOST_ARCH ]
then
DBD=$(cygpath -wp $DBD)
fi
export EPICS_DRIVER_PATH
loadFiles () {
while [ "$#" -gt 0 ]
do
file=$1
case $file in
( -32 )
echo "-32 option must be set earlier" >&2
exit 1
;;
( -[1-9]* )
echo "EPICS version $file option must be set earlier" >&2
exit 1
;;
( -h | "-?" | -help | --help )
help
;;
( -v | -ver | --ver | -version | --version )
version
;;
( @* )
loadFiles $(cat ${file#@})
;;
( -d | -dg | --debug )
LOADER="gdb --eval-command run --args $LOADER"
;;
( -dv )
LOADER="valgrind --leak-check=full $LOADER"
;;
( -dp )
LOADER="perf record $LOADER"
;;
( -c )
shift
case $1 in
( seq* )
if [ "$init" != NO ]
then
echo "iocInit"
init=NO
fi
;;
( iocInit )
init=NO
;;
esac
echo $1
;;
( -s )
shift
if [ "$init" != NO ]
then
echo "iocInit"
init=NO
fi
echo "seq $1"
;;
( -r )
shift
echo "require $1"
;;
( -n )
shift
IOC="$1"
;;
( -* )
echo "Unknown option $1" >&2
echo "Try: $(basename $0) --help" >&2
exit 1
;;
( *.so )
if [ "$BASECODE" -ge 31412 ]
then
echo "dlload \"$file\""
else
echo "ld \"$file\""
fi
;;
( *=* )
echo -n $file | awk -F '=' '{printf "epicsEnvSet %s '\''%s'\''\n", $1, $2}'
;;
( * )
subst=""
while [ "$#" -gt 1 ]
do
case $2 in
( *=* )
subst="$subst,$2"; shift
;;
( * )
break
;;
esac
done
subst=${subst#,}
case $file in
( *.db | *.template)
echo "dbLoadRecords '$file','$subst'"
;;
( *.subs | *.subst )
echo "dbLoadTemplate '$file','$subst'"
;;
( *.dbd )
# some dbd files must be loaded before main to take effect
echo "dbLoadDatabase '$file','$DBD','$subst'"
;;
( * )
if [ "$BASECODE" -ge 31500 ]
then
echo "iocshLoad '$file','$subst'"
else
echo -n $subst | awk -F '=' -v 'RS=,' '{printf "epicsEnvSet %s '\''%s'\''\n", $1, $2}'
echo "< '$file'"
fi
if grep -q iocInit $file; then init=NO; fi
;;
esac
;;
esac
shift
done
}
startup=/tmp/iocsh.startup.$$
# clean up and kill the softIoc when killed by any signal
trap "kill -s SIGTERM 0; (stty sane && echo) 2>/dev/null; rm -f $startup; " EXIT
{
echo "# date=\"$(date)\""
echo "# user=\"${USER:-$(whoami)}\""
for var in IOC PWD BASE EPICS_HOST_ARCH SHELLBOX EPICS_CA_ADDR_LIST EPICS_DRIVER_PATH
do
echo "# $var=\"${!var}\""
done
LIBPREFIX=lib
LIBPOSTFIX=.so
if [ -d $EPICS_MODULES/${REQUIRE:=require} ]
then # new module pool model
REQUIRE_LIB=$(ls -1rv $EPICS_MODULES/$REQUIRE/${REQUIRE_VERSION:-*.*.*}/R$BASE/lib/$EPICS_HOST_ARCH/$LIBPREFIX$REQUIRE$LIBPOSTFIX | head -n 1)
REQUIRE_DBD=${REQUIRE_LIB%/lib/*}/dbd/$REQUIRE.dbd
else # old driver pool model
REQUIRE=misc${REQUIRE_VERSION:+-}$REQUIRE_VERSION
REQUIRE_LIB=$INSTBASE/iocBoot/R$BASE/$EPICS_HOST_ARCH/$LIBPREFIX$REQUIRE$LIBPOSTFIX
REQUIRE_DBD=$INSTBASE/iocBoot/R$BASE/dbd/$REQUIRE.dbd
fi
if [ "$BASECODE" -ge 31412 ]
then
EXE=$EPICS_BASE/bin/$EPICS_HOST_ARCH/softIoc
ARGS="-D $EPICS_BASE/dbd/softIoc.dbd"
LDCMD="dlload"
else
# get rid of the compiled-in rpath because at PSI that is a link pointing to current EPICS version.
LOADER="$LOADER /lib/ld-linux.so.2"
LOADERARGS="--library-path $EPICS_BASE/lib/$EPICS_HOST_ARCH --inhibit-rpath ''"
APP=ioc
EXE=$EPICS_EXTENSIONS/bin/$EPICS_HOST_ARCH/$APP
DBD=$EPICS_EXTENSIONS/dbd
LDCMD="ld"
echo "dbLoadDatabase \"$APP.dbd\",\"$DBD\""
echo "${APP}_registerRecordDeviceDriver(pdbbase)"
fi
if [ ! -x $EXE ]
then
echo "$EXE not found or not executable." >&2
exit 1
fi
if [ ! -f "$REQUIRE_LIB" ]
then
echo "Library $REQUIRE_LIB not found." >&2
echo "Command 'require' is not available." >&2
else
echo "$LDCMD $REQUIRE_LIB"
echo "dbLoadDatabase $REQUIRE_DBD"
echo "${REQUIRE%-*}_registerRecordDeviceDriver"
echo "require misc $MISC_VERSION"
fi
loadFiles "$@"
if [ "$init" != NO ]
then
echo "iocInit"
fi
if [ "$SHELLBOX" ]
then
PATH=$PATH:/home/ioc/bin
export BCAST_ADDR=$(/sbin/ifconfig | awk -F '[ :]+' '/Bcast/ {print $6; exit}')
echo "! rm -f /tmp/${IOC}.dbl"
echo 'dbl "","RTYP DESC" > /tmp/${IOC}.dbl'
echo "! dbl2odb.sh ${IOC} \"$BCAST_ADDR\" \"$EPICS_CA_SERVER_PORT\""
echo "! rm -f /tmp/${IOC}.libs"
echo "libversionShow > /tmp/${IOC}.libs"
echo "! upload_libinfo.py -i ${IOC} -l /tmp/${IOC}.libs"
fi
echo 'epicsEnvSet IOCSH_PS1,"${IOC}> "'
} > $startup
# convert startup script file name for win32-x86
if [ ${EPICS_HOST_ARCH#win32-} != $EPICS_HOST_ARCH ]
then
startup=`cygpath -w $startup`
fi
if [ ${EPICS_HOST_ARCH#win32-} != $EPICS_HOST_ARCH -o ${EPICS_HOST_ARCH#cygwin-} != $EPICS_HOST_ARCH ]
then
PATH=$INSTBASE/iocBoot/R$BASE/$EPICS_HOST_ARCH:$EPIC_BASE/bin/$EPICS_HOST_ARCH:$EPICS_BASE/../seq/bin/$EPICS_HOST_ARCH:$PATH
fi
echo $EXE $ARGS $startup
#enable core dumps
ulimit -c unlimited
eval "$LOADER $LOADERARGS $EXE" $ARGS "$startup" 2>&1
......@@ -52,7 +52,7 @@ declare STARTUP=""
declare BASECODE=""
declare -r TMP_PATH="/tmp/systemd-private-e3-iocsh-$(whoami)"
. ${SC_TOP}/iocsh_functions
. ${SC_TOP}/iocsh_functions.bash
# To get the absolute path where iocsh.bash is executed
......
#!/usr/bin/env bash
# -*- mode: sh -*-
#
# Copyright (c) 2004 - 2017 Paul Scherrer Institute
......@@ -331,6 +332,7 @@ function check_mandatory_env_settings() {
function loadEnv() {
local envfile=$IOCSH_TOP/env.sh
local warn=false
while [ $# -gt 0 ]; do
arg=$1
......@@ -338,6 +340,7 @@ function loadEnv() {
-e)
shift
envfile=$1
warn=true
;;
esac
shift
......@@ -346,7 +349,7 @@ function loadEnv() {
if [ -f "$envfile" ]; then
echo "Loading environment variables from $envfile"
source "$envfile"
else
elif [ "$warn" = true ]; then
echo "Warning: environment file $envfile does not exist." >&2
fi
}
......@@ -357,12 +360,6 @@ function loadFiles() {
file=$1
case $file in
-h | "-?" | -help | --help)
help
;;
-v | -ver | --ver | -version | --version)
version
;;
-rt | -RT | -realtime | --realtime)
REALTIME="RT"
__LOADER__="chrt --fifo 1 "
......@@ -417,6 +414,10 @@ function loadFiles() {
-e)
shift
;;
-n)
__LOADER__="nice --10 "
shift
;;
-*)
printf "Unknown option $1\n\n" >&2
help
......@@ -494,11 +495,15 @@ function help() {
printf "Options:\n\n"
printf " -?, -h, --help Show this page and exit.\n"
printf " -v, --version Show version and exit.\n"
printf " -e 'env_file' Load a given environment file 'env_file'.\n"
printf " -c 'cmd args' Ioc shell command.\n"
printf " -l 'cell path' Run Ioc with a cell path.\n"
printf " -s 'prog m=v' Sequencer program (and arguments), run with 'seq'.\n"
printf " This forces an 'iocInit' before running the program.\n"
printf " -r module[,ver] Modue (optionally with version) loaded via 'require'.\n"
printf " -dg Run with debugger gdb.\n"
printf " -dv Run with valgrind.\n"
printf " -n Run with 'nice --10' (requires sudo).\n"
printf " @file More arguments are read from file.\n\n"
printf "Supported filetypes:\n\n"
printf " *.db, *.dbt, *.template loaded via 'dbLoadRecords'\n"
......@@ -517,3 +522,15 @@ function help() {
} >&2
exit
}
for arg in "$@"; do
case $arg in
-h | "-?" | -help | --help)
help
;;
-v | -ver | --ver | -version | --version)
version
;;
*) ;;
esac
done
\ No newline at end of file
#!/bin/bash
#
# Copyright (c) 2004 - 2017 Paul Scherrer Institute
# Copyright (c) 2017 - 2019 European Spallation Source ERIC
#
# The program is free software: you can redistribute
# it and/or modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation, either version 2 of the
# License, or any newer version.
#
# This program is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
# more details.
#
# You should have received a copy of the GNU General Public License along with
# this program. If not, see https://www.gnu.org/licenses/gpl-2.0.txt
#
#
# PSI original iocsh author : Dirk Zimoch
# ESS specific iocsh author : Jeong Han Lee
# email : han.lee@esss.se
#
declare -r SC_SCRIPT="$(readlink -e "$0")"
declare -r SC_SCRIPTNAME=${0##*/}
declare -r SC_TOP="${SC_SCRIPT%/*}"
declare SC_VERSION="${E3_REQUIRE_VERSION}-gdb"
declare STARTUP=""
declare BASECODE=""
. ${SC_TOP}/iocsh_functions
BASECODE="$(basecode_generator)"
check_mandatory_env_settings
# ${BASHPID} returns iocsh.bash PID
iocsh_bash_id=${BASHPID}
#
SC_VERSION+=-PID-${iocsh_bash_id}
#
# We define HOSTNAME + iocsh_bash_id
IOCSH_PS1=$(iocsh_ps1 "${iocsh_bash_id}")
REQUIRE_IOC=$(require_ioc "${iocsh_bash_id}")
#
# Default Initial Startup file for REQUIRE and minimal environment
IOC_STARTUP=$(mktemp -q --suffix=_iocsh_${SC_VERSION}) || die 1 "${SC_SCRIPTNAME} CANNOT create the startup file, please check the disk space";
# To get the absolute path where iocsh.bash is executed
IOCSH_TOP=${PWD}
# EPICS_DRIVER_PATH defined in iocsh and startup.script_common
# Remember, driver is equal to module, so EPICS_DRIVER_PATH is the module directory
# In our jargon. It is the same as ${EPICS_MODULES}
trap "softIoc_end ${IOC_STARTUP}" EXIT HUP INT TERM
{
printIocEnv;
printf "# Set REQUIRE_IOC for its internal PVs\n";
printf "epicsEnvSet REQUIRE_IOC \"${REQUIRE_IOC}\"\n";
printf "#\n";
printf "# Set E3_IOCSH_TOP for the absolute path where %s is executed.\n" "${SC_SCRIPTNAME}"
printf "epicsEnvSet E3_IOCSH_TOP \"${IOCSH_TOP}\"\n";
printf "#\n";
loadRequire;
loadFiles "$@";
printf "# Set the IOC Prompt String One \n";
printf "epicsEnvSet IOCSH_PS1 \"$IOCSH_PS1\"\n";
printf "#\n";
if [ "$init" != NO ]; then
printf "# \n";
printf "iocInit\n"
fi
} > ${IOC_STARTUP}
ulimit -c unlimited
# -x "PREFIX"
# PREFIX:exit & PREFIX:BaseVersion PVs are added to softIoc
# We can end this IOC via caput PREFIX:exit 1
if [[ ${BASECODE} -ge 07000101 ]]; then
_PVA_="PVA"
else
_PVA_=""
fi
gdb --eval-command run --args softIoc${_PVA_} -D ${EPICS_BASE}/dbd/softIoc${_PVA_}.dbd "${IOC_STARTUP}" 2>&1
#!/bin/bash
#
# Copyright (c) 2004 - 2017 Paul Scherrer Institute
# Copyright (c) 2017 - 2019 European Spallation Source ERIC
#
# The program is free software: you can redistribute
# it and/or modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation, either version 2 of the
# License, or any newer version.
#
# This program is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
# more details.
#
# You should have received a copy of the GNU General Public License along with
# this program. If not, see https://www.gnu.org/licenses/gpl-2.0.txt
#
#
# PSI original iocsh author : Dirk Zimoch
# ESS specific iocsh author : Jeong Han Lee
# email : han.lee@esss.se
#
declare -r SC_SCRIPT="$(readlink -e "$0")"
declare -r SC_SCRIPTNAME=${0##*/}
declare -r SC_TOP="${SC_SCRIPT%/*}"
declare SC_VERSION="${E3_REQUIRE_VERSION}-nice"
declare STARTUP=""
declare BASECODE=""
. ${SC_TOP}/iocsh_functions
BASECODE="$(basecode_generator)"
check_mandatory_env_settings
#
SC_VERSION+=-PID-${BASHPID}
#
# We define HOSTNAME + BASHPID
IOCSH_PS1=$(iocsh_ps1 "${BASHPID}")
REQUIRE_IOC=$(require_ioc "${BASHPID}")
#
# Default Initial Startup file for REQUIRE and minimal environment
IOC_STARTUP=/tmp/${SC_SCRIPTNAME}-${SC_VERSION}-startup
# To get the absolute path where iocsh.bash is executed
IOCSH_TOP=${PWD}
# EPICS_DRIVER_PATH defined in iocsh and startup.script_common
# Remember, driver is equal to module, so EPICS_DRIVER_PATH is the module directory
# In our jargon. It is the same as ${EPICS_MODULES}
trap "softIoc_end ${IOC_STARTUP}" EXIT HUP INT TERM
{
printIocEnv;
printf "# Set REQUIRE_IOC for its internal PVs\n";
printf "epicsEnvSet REQUIRE_IOC \"${REQUIRE_IOC}\"\n";
printf "#\n";
printf "# Set E3_IOCSH_TOP for the absolute path where %s is executed.\n" "${SC_SCRIPTNAME}"
printf "epicsEnvSet E3_IOCSH_TOP \"${IOCSH_TOP}\"\n";
printf "#\n";
loadRequire;
loadFiles "$@";
printf "# Set the IOC Prompt String One \n";
printf "epicsEnvSet IOCSH_PS1 \"$IOCSH_PS1\"\n";
printf "#\n";
if [ "$init" != NO ]; then
printf "# \n";
printf "iocInit\n"
fi
} > ${IOC_STARTUP}
ulimit -c unlimited
# -x "PREFIX"
# PREFIX:exit & PREFIX:BaseVersion PVs are added to softIoc
# We can end this IOC via caput PREFIX:exit 1
if [[ ${BASECODE} -ge 07000101 ]]; then
_PVA_="PVA"
else
_PVA_=""
fi
nice --10 softIoc${_PVA_} -D ${EPICS_BASE}/dbd/softIoc${_PVA_}.dbd "${IOC_STARTUP}" 2>&1
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment