#!/bin/sh # # agbs This shell script takes care of starting and stopping # the Access Grid Bridge Server # # chkconfig: - 95 10 # description: The Access Grid Bridge Server # Source function library. . /etc/init.d/functions # Source networking configuration. . /etc/sysconfig/network # Configuration file configfile=/home/ag/BridgeServer.cfg bridge=/usr/bin/BridgeServer.py application=BridgeServer.py quickbridge=QuickBridge # Check that networking is up. [ ${NETWORKING} = "no" ] && exit 0 [ -x $bridge ] || exit RETVAL=0 prog="AGBridgeServer" datadir="/var/run/agbs" start() { # Start daemons. touch /var/log/agbs.log chown ag.ag /var/log/agbs.log chmod 0640 /var/log/agbs.log if [ ! -d $datadir ]; then mkdir -p $datadir chown -R ag.ag $datadir chmod 0640 $datadir fi echo -n $"Starting $prog: " initlog $INITLOG_ARGS -c \ "su ag -c \"cd /home/ag && $bridge -c $configfile &\"" RETVAL=$? [ "$RETVAL" -eq 0 ] && success $"bridge startup" || \ failure $"bridge start" echo [ $RETVAL -eq 0 ] && touch /var/lock/subsys/agbs return $RETVAL } stop() { # Stop daemons. set -vx echo -n $"Shutting down bridges: " killproc $quickbridge echo echo -n $"Shutting down $prog: " killproc $application RETVAL=$? echo if [ -d $datadir ]; then rm -rf $datadir fi [ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/agbs return $RETVAL } # See how we were called. case "$1" in start) start ;; stop) stop ;; status) status agbs RETVAL=$? ;; restart|reload) stop start RETVAL=$? ;; condrestart) if [ -f /var/lock/subsys/agbs ]; then stop start RETVAL=$? fi ;; *) echo $"Usage: $0 {start|stop|restart|condrestart|status}" exit 1 esac exit $RETVAL