Some SysV Init Scripts for BaBar Services
From GridPP Wiki
Revision as of 17:15, 2 December 2005 by Chris brew (Talk | contribs)
Contents
genxrd
This script can start up either xrootd or olbd depending on it's name when called
#!/bin/sh # $Id: xrootd.init,v 0.1 2004/06/15 12:10:29 brew Exp $ # Rewritten 2004/06/15 C.A.J.Brew@rl.ac.uk # # chkconfig: 345 96 04 # description: Generic xrootd/olbd startup script # SCRIPTDIR=/opt/xrootd/etc/ RETVAL=0 CALL=`/bin/basename $0` . /etc/rc.d/init.d/functions start() { echo -n "Starting $service server: " [ -f $SCRIPTDIR/Start$FUN ] || exit 1 daemon $SCRIPTDIR/Start$FUN RETVAL=$? echo [ $RETVAL = 0 ] && touch /var/lock/subsys/$service return $RETVAL } stop() { echo -n "Shutting down $service server: " $SCRIPTDIR/Stop$FUN > /dev/null 2>&1 RETVAL=$? if [ $RETVAL -eq 0 ] then rm -f /var/lock/subsys/$service echo_success else echo_failure fi echo return $RETVAL } # See how we were called case "$CALL" in xrootd|S??xrootd|K??xrootd) service=xrootd FUN=XRD ;; olbd|S??olbd|K??olbd) service=olbd FUN=OLB ;; *) echo Do not know how to start $CALL exit 1 ;; esac case "$1" in start) start ;; stop) stop ;; restart|reload) stop start ;; condrestart) if [ -e /var/lock/subsys/$service ]; then stop start fi ;; status) status $service RETVAL=$? ;; *) echo "Usage: $0 {start|stop|reload|restart|condrestart|status}" exit 1 esac exit $RETVAL
slac-ams
#!/bin/sh # $Id: slac-ams.init,v 0.1 2004/06/15 12:10:29 brew Exp $ # Rewritten 2004/06/15 C.A.J.Brew@rl.ac.uk # # chkconfig: 345 97 03 # description: SLAC AMS server startup script # BASEDIR=/opt/objy/ SCRIPTDIR=$BASEDIR/etc/ooss BDBPUDPATH=/opt/objy/pud RETVAL=0 HOST=`hostname -f` user=objysrv #CALL=`/bin/basename $0` . /etc/rc.d/init.d/functions start() { fail=0 echo -n "Starting base AMS Server: " su -m -c " $SCRIPTDIR/StartAMS > /dev/null 2>&1" $user RETVAL=$? if [ $RETVAL -eq 0 ] then echo_success else fail=1 echo_failure fi echo for port in `grep ooams /etc/services | awk '{print $1}'` do echo -n "Starting AMS Server on $port: " su -m -c " $SCRIPTDIR/StartAMS -s $port > /dev/null 2>&1" $user RETVAL=$? if [ $RETVAL -eq 0 ] then echo_success else fail=1 echo_failure fi echo done [ $fail = 0 ] && touch /var/lock/subsys/slac-ams } stop() { echo -n "Shutting down AMS Servers: " $SCRIPTDIR/StopAMS > /dev/null 2>&1 RETVAL=$? if [ $RETVAL -eq 0 ] then rm -f /var/lock/subsys/slac-ams echo_success else echo_failure fi echo } case "$1" in start) start ;; stop) stop ;; restart|reload) stop start ;; condrestart) if [ -e /var/lock/subsys/ams ]; then stop start fi ;; status) status ooams RETVAL=$? ;; *) echo "Usage: $0 {start|stop|reload|restart|condrestart|status}" exit 1 esac exit $RETVAL
ools
#!/bin/sh # $Id: ools.init,v 0.1 2004/06/15 12:10:29 brew Exp $ # Rewritten 2004/06/15 C.A.J.Brew@rl.ac.uk # # chkconfig: 345 96 04 # description: Objectivity Lockserver startup script # BASEDIR=/opt/objy/ SCRIPTDIR=$BASEDIR/etc/ooss RETVAL=0 user=objysrv PATH=${PATH}${PATH:+:}/sbin:/bin:/usr/bin OBJECT=/opt/objy/objy8.0.9/linux86gcc3 OO_RPC_TIMEOUT=600 if [ -z "$LD_LIBRARY_PATH" ]; then LD_LIBRARY_PATH=$OBJECT/lib else LD_LIBRARY_PATH=$OBJECT/lib:$LD_LIBRARY_PATH fi BFSITE=ral HOST=`hostname -f` export OO_RPC_TIMEOUT LD_LIBRARY_PATH PATH BFSITE HOST #CALL=`/bin/basename $0` . /etc/rc.d/init.d/functions start() { echo -n "Starting ools: " su -m -c "$OBJECT/bin/oolockserver > /dev/null 2>&1" $user RETVAL=$? if [ $RETVAL -eq 0 ] then touch /var/lock/subsys/ools echo_success else echo_failure fi echo return $RETVAL } stop() { echo -n "Shutting down ools: " $OBJECT/bin/ookillls > /dev/null 2>&1 RETVAL=$? if [ $RETVAL -eq 0 ] then rm -f /var/lock/subsys/ools echo_success else echo_failure fi echo return $RETVAL } case "$1" in start) start ;; stop) stop ;; restart|reload) stop start ;; condrestart) if [ -e /var/lock/subsys/ools ]; then stop start fi ;; status) status ools RETVAL=$? ;; *) echo "Usage: $0 {start|stop|reload|restart|condrestart}" exit 1 esac exit $RETVAL
pud
#!/bin/sh # $Id: pud.init,v 0.1 2004/06/15 12:10:29 brew Exp $ # Rewritten 2004/06/15 C.A.J.Brew@rl.ac.uk # # chkconfig: 345 95 05 # description: PUD startup script # BASEDIR=/opt/objy/ SCRIPTDIR=$BASEDIR/etc/ooss BDBPUDPATH=/opt/objy/pud RETVAL=0 HOST=`hostname -f` user=objysrv BFSITE=ral export BFSITE HOST #CALL=`/bin/basename $0` . /etc/rc.d/init.d/functions start() { echo -n "Starting PUD: " cd $BDBPUDPATH su -m -c "$BDBPUDPATH/BdbAdminDaemon -start -32 > /dev/null 2>&1" $user #$BDBPUDPATH/BdbAdminDaemon -start -32 RETVAL=$? echo [ $RETVAL = 0 ] && touch /var/lock/subsys/pud return $RETVAL } stop() { echo -n "Shutting down PUD: " cd $BDBPUDPATH $BDBPUDPATH/BdbAdminDaemon -terminate > /dev/null 2>&1 RETVAL=$? if [ $RETVAL -eq 0 ] then rm -f /var/lock/subsys/pud echo_success else echo_failure fi echo return $RETVAL } case "$1" in start) start ;; stop) stop ;; restart|reload) stop start ;; condrestart) if [ -e /var/lock/subsys/pud ]; then stop start fi ;; *) echo "Usage: $0 {start|stop|reload|restart|condrestart}" exit 1 esac exit $RETVAL
--Chris brew 18:01, 26 Oct 2005 (BST)