#! /bin/sh # # perlbal Start and Stop the perlbal daemon # ### BEGIN INIT INFO # Provides: perlbal # Required-Start: $local_fs $remote_fs $network $syslog # Required-Stop: $local_fs $remote_fs $network $syslog # Default-Start: 2 3 4 5 # Default-Stop: 0 1 6 # Short-Description: Start/Stop the perlbal daemon # Description: Start/Stop the perlbal daemon. ### END INIT INFO # PATH should only include /usr/* if it runs after the mountnfs.sh script PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin DAEMON=/usr/sbin/perlbal NAME=perlbal DESC=Perlbal PIDFILE=/var/run/$NAME.pid USER=root SCRIPTNAME=/etc/init.d/$NAME # Exit if the package is not installed [ -x "$DAEMON" ] || exit 0 set -e # Read configuration variable file if it is present [ -r /etc/default/$NAME ] && . /etc/default/$NAME # Load the VERBOSE setting and other rcS variables . /lib/init/vars.sh # # Function that starts the daemon/service # do_start() { if [ -e $PIDFILE ] then if [ -d /proc/`cat $PIDFILE`/ ] then echo "$NAME already running." exit 0; else rm -f $PIDFILE fi fi start-stop-daemon --start --quiet --exec $DAEMON --pidfile $PIDFILE -b -m --name $NAME --user $USER } # # Function that stops the daemon/service # do_stop() { start-stop-daemon --stop --quiet --oknodo --pidfile $PIDFILE --name $NAME --user $USER rm -f $PIDFILE } case "$1" in start) echo -n "Starting $DESC: " do_start echo "$NAME." ;; stop) echo -n "Stopping $DESC: " do_stop echo "$NAME." ;; restart|force-reload) # # If the "reload" option is implemented, move the "force-reload" # option to the "reload" entry above. If not, "force-reload" is # just the same as "restart". # echo -n "Restarting $DESC: " do_stop sleep 1 do_start echo "$NAME." ;; *) #echo "Usage: $SCRIPTNAME {start|stop|restart|reload|force-reload}" >&2 echo "Usage: $SCRIPTNAME {start|stop|restart|force-reload}" >&2 exit 3 ;; esac exit 0