#! /bin/sh
#
# chkconfig: - 60 20
# description: printbill daemon
# processname: printbilld
#
# RedHat SysV init script for printbill - put it in /etc/rc.d/init.d/ and
# make a symbolic link as follows:
#
# cd /etc/rc.d/rc2.d ; ln -sf ../init.d/printbilld S19printbilld
#
# On RedHat systems this will start it just before lprng
# so the socket is read and waiting when lprng starts.

# Get config.
#. /etc/sysconfig/network

# Get functions
. /etc/init.d/functions

RETVAL=0

start() {
 	echo -n $"Starting printbill services: "
	daemon printbilld
	RETVAL=$?
	echo
	[ $RETVAL -eq 0 ] && touch /var/lock/subsys/printbilld
	return $RETVAL
}	

stop() {
	echo -n $"Stopping printbill services: "
	killproc printbilld
	RETVAL=$?
	echo
	[ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/printbilld
	return $RETVAL
}	

restart() {
	stop
	start
}

reload() {
	echo -n $"Reloading /etc/printbill/printbillrc: "
	killproc printbilld -HUP
	RETVAL=$?
	echo
	return $RETVAL
}

# See how we were called.
case "$1" in
 start)
 	start
	;;
 stop)
 	stop
	;;
 status)
 	status printbilld
	;;
 restart)
 	restart
	;;
 condrestart)
 	[ -f /var/lock/subsys/printbilld ] && restart || :
	;;
 reload)
 	reload
 	;;
 *)
	echo $"Usage: $0 {start|stop|status|restart}"
	exit 1
	;;
esac

exit $?
