#!/bin/sh # # cabie build server init script for SuSE # # /etc/init.d/cabie # Bugs: Hangs in Yast2 # # LSB compatible service control script; see http://www.linuxbase.org/spec/ # ### BEGIN INIT INFO # Provides: cabie # Required-Start: $network mysql # Required-Stop: # Default-Start: 3 5 # Default-Stop: 0 1 2 6 # Short-Description: cabie build server # Description: cabie build server # This services is needed to use cabie build server ### END INIT INFO # # usage: start|stop|status|restart # usage() { test -n "$1" && echo $1 echo "Usage: $0 [INTERFACE] [OPTIONS]" echo "ACTION:={start|stop|status|restart}" } # Shell functions sourced from /etc/rc.status: # rc_check check and set local and overall rc status # rc_status check and set local and overall rc status # rc_status -v ditto but be verbose in local rc status # rc_status -v -r ditto and clear the local rc status # rc_status -s display "skipped" and exit with status 3 # rc_status -u display "unused" and exit with status 3 # rc_failed set local and overall rc status to failed # rc_failed set local and overall rc status to # rc_reset clear local rc status (overall remains) # rc_exit exit appropriate to overall rc status # rc_active checks whether a service is activated by symlinks # rc_splash arg sets the boot splash screen to arg (if active) . /etc/rc.status # First reset status of this service rc_reset # Return values acc. to LSB (Linux Standard Base) for all commands but status: # 0 - success # 1 - generic or unspecified error # 2 - invalid or excess argument(s) # 3 - unimplemented feature (e.g. "reload") # 4 - insufficient privilege # 5 - program is not installed # 6 - program is not configured # 7 - program is not running # case "$1" in 'start') $0 status &>/dev/null ret=$? if [ $ret = 0 ]; then echo "Cabie buildserver already running." rc_failed $ret rc_status -v1 rc_exit fi if [ -f /opt/Cabie/server/buildserver.pl ]; then cd /opt/Cabie/server echo "Starting Cabie build server" /opt/Cabie/server/buildserver.pl -s 9190 -m 9192 -d rc_status -v fi rc_status -v echo ;; 'stop') if [ -f /opt/Cabie/client/build.pl ]; then echo -n "Shutting down Cabie buildserver" /opt/Cabie/client/build.pl -s `/bin/hostname` -p 9190 shutdown > /dev/null 2>&1 fi rc_failed 0 rc_status -v ;; status) echo -n "Checking for service Cabie buildserver: " # Status has a slightly different for the status command: # 0 - service running # 1 - service dead, but /var/run/ pid file exists # 2 - service dead, but /var/lock/ lock file exists # 3 - service not running # NOTE: checkproc returns LSB compliant status values. pidofproc -k buildserver.pl rc_status -v ;; restart) $0 stop $0 start rc_status ;; *) usage "unknown action $1" exit 1 ;; esac rc_exit