#!/bin/bash # # cabie build server init script for RHEL3 # # chkconfig: 345 98 35 # description: The Cabie build server is an automated distributed build system. # # usage: start|stop|restart # RETVAL=0 prog="Cabie" start() { echo -n "Starting $prog: " if [ -f /opt/Cabie/server/buildserver.pl ]; then cd /opt/Cabie/server /opt/Cabie/server/buildserver.pl -s 9190 -m 9192 -d RETVAL=$? fi return $RETVAL } stop() { echo -n "Stoping $prog: " if [ -f /opt/Cabie/client/build.pl ]; then /opt/Cabie/client/build.pl -s `hostname` -p 9190 shutdown > /dev/null 2>&1 RETVAL=$? ps axwww | grep "buildserver" | awk '{print $1}' | \ ( while read pid; do kill -9 $pid; done ) fi return $RETVAL } case "$1" in start) start ;; stop) stop ;; restart) stop sleep 2 start RETVAL=$? ;; *) echo "usage: $0 {start|stop|restart}" exit 1 ;; esac exit $RETVAL