#! /bin/sh # ### BEGIN INIT INFO # Provides: tsaserver # Required-Start: $network $remote_fs # Required-Stop: $network # X-UnitedLinux-Should-Start: portmap autofs # Default-Start: 3 5 # Default-Stop: # Description: Start Marvelous TSA server ### END INIT INFO # Check for existence of needed config file and read it tsaserver_CONFIG=/etc/sysconfig/tsaserver test -r $tsaserver_CONFIG || { echo "$tsaserver_CONFIG not existing"; if [ "$1" = "stop" ]; then exit 0; else exit 6; fi; } # Read config . $tsaserver_CONFIG # exe=/srv/TSA/bin/tsaserver # confdir=/srv/TSA/etc #ld_library_path=/srv/TSA/lib test -x $exe || exit 0 test -d $confdir || exit 0 conffiles=$confdir/*.conf . /etc/rc.status rc_reset case "$1" in start) for conffile in $conffiles ; do echo -n "Starting Marvelous TSA server ($conffile) " $exe -c $conffile &> /dev/null & # LD_LIBRARY_PATH=$ld_library_path $exe -c $conffile &> /dev/null & sleep 1 ; kill -0 $! &> /dev/null rc_status -v done ;; stop) for conffile in $conffiles ; do echo -n "Stopping Marvelous TSA server ($conffile) " pkill -f "$exe -c $conffile" &> /dev/null rc_status -v done ;; status) for conffile in $conffiles ; do echo -n "Checking for Marvelous TSA server ($conffile) " pgrep -f "$exe -c $conffile" &> /dev/null rc_status -v done ;; kill) echo -n "Killing Marvelous TSA server" pkill -f "$exe" rc_status -v ;; try-restart) $0 stop && $0 start rc_status ;; restart) $0 stop $0 start rc_status ;; *) echo "Usage: $0 {start|stop|status|try-restart|restart}" exit 1 esac rc_exit