#!/bin/sh
# DESCRIPTION: Example file to put in /etc/init.d to run daemon
#
# Copyright 2002-2004 by Wilson Snyder.  This program is free software;
# you can redistribute it and/or modify it under the terms of either the GNU
# General Public License or the Perl Artistic License.
#
# chkconfig: 23456 99 10
# description: Slchoosed provides clump-wide scheduling services for Schedule::Load
# processname: slchoosed

state=$1

case $state in
'start')
        echo starting /usr/local/bin/slchoosed if present
        [ -f /usr/local/bin/slchoosed ] &&  su daemon -c /usr/local/bin/slchoosed &
	exit 0
        ;;
  stop)
        if test "x`pidof -o $$ -o $PPID -x slchoosed`" != x; then
                echo -n $"Stopping slchoosed: "
                kill `pidof -o $$ -o $PPID -x slchoosed`
                echo
        fi
	exit 0
        ;;
  restart|reload)
	$0 stop
	$0 start
	exit 0
	;;
  status)
        if test "x`pidof -o $$ -o $PPID -x slchoosed`" != x; then
  	        ps f -ww `pidof -o $$ -o $PPID -x slchoosed`
        fi
	exit 0
	;;
*)
	echo $"Usage: $0 {start|stop|restart|reload|status}"
	exit 1
esac
