Boot Scripts

From LNLEpicsWiki

Jump to: navigation, search

[edit] Archiver

The following script has been added as /etc/init.d/ca-archiver (based on another script there with some dirty hacks....):

#!/bin/bash
#
# Startup script for Channel Access Archiver
#
# chkconfig: - 92 36
# description: Start/Stop the Channel Access Archiver

# Source function library.
. /etc/rc.d/init.d/functions

# Source function library.
if [ -f /etc/init.d/functions ] ; then
  . /etc/init.d/functions
elif [ -f /etc/rc.d/init.d/functions ] ; then
  . /etc/rc.d/init.d/functions
else
  exit 0
fi

# Some definitions.
arch_daemon_start=/arch/Target/run-daemon.sh
arch_daemon_stop=/arch/Target/stop-daemon.sh
arch_engine_stop=/arch/Target/target/stop-engine.sh
prog=CA_Archiver
RETVAL=0
PATH=/opt/epics/extensions/bin/linux-x86/:$PATH

#
start() {
        echo -n $"Starting $prog: "
        su epics -c "$arch_daemon_start >/dev/null"
        RETVAL=$?
        echo
        if [ $RETVAL = 0 ] ; then
           touch /var/lock/subsys/ca-archiver
        else
           RETVAL=1
        fi
        return $RETVAL
}

stop() {
        echo -n $"Stopping $prog: "
        $arch_daemon_stop >/dev/null
        $arch_engine_stop >/dev/null
        RETVAL=$?
        echo
        if [ $RETVAL = 0 ] ; then
           rm -f /var/lock/subsys/ca-archiver
        else
           RETVAL=1
        fi
        return $RETVAL
}

# See how we were called.
case "$1" in
  start)
        start
        ;;
  stop)
        stop
        ;;
  restart)
        stop
        start
        ;;
  condrestart)
        [ -f /var/lock/subsys/ca-archiver ] && restart
        ;;
  *)
        echo $"Usage: $prog {start|stop|restart|condrestart}"
        exit 1
esac

exit $RETVAL

[edit] Soft IOCs

Same for the SoftIOCs (/etc/init.d/softioc)

#!/bin/bash
#
# Startup script for soft IOCs
#
# chkconfig: - 92 36
# description: Start/Stop softIOCs

# Source function library.
. /etc/rc.d/init.d/functions

# Source function library.
if [ -f /etc/init.d/functions ] ; then
  . /etc/init.d/functions
elif [ -f /etc/rc.d/init.d/functions ] ; then
  . /etc/rc.d/init.d/functions
else
  exit 0
fi

# Some definitions for our soft IOCs

ioc1_name=TICBOCE
ioc1_dir=/ioc/playground/TICBOCE/iocBoot/ioctb
ioc1_port=24700
ioc1_pid=$ioc1_dir/ioc.pid

ioc2_name=ESSLAMB
ioc2_dir=/ioc/playground/ESSLAMB/iocBoot/iocess
ioc2_port=24701
ioc2_pid=$ioc2_dir/ioc.pid

prog=softIOCs
RETVAL=0
PATH=/usr/local/bin:$PATH

#
start() {
        echo -n $"Starting $prog: "
        su epics -c "procServ -c $ioc1_dir -i^C^D -n $ioc1_name -p $ioc1_pid -q $ioc1_port ./st.cmd"
        su epics -c "procServ -c $ioc2_dir -i^C^D -n $ioc2_name -p $ioc2_pid -q $ioc2_port ./st.cmd"
        echo
        return $RETVAL
}

stop() {
        echo -n $"Stopping $prog: "
        killproc -p $ioc1_pid procServ
        killproc -p $ioc2_pid procServ
        echo
        return $RETVAL
}

# See how we were called.
case "$1" in
  start)
        start
        ;;
  stop)
        stop
        ;;
  restart)
        stop
        start
        ;;
  *)
        echo $"Usage: $prog {start|stop|restart}"
        exit 1
esac

exit $RETVAL

This information might not be up-to-date. Please look at the real files for accuracy.

Personal tools