#!/bin/sh
# $Id: template,v 1.3 2003/05/21 17:47:00 ldv Exp $
#
# template	Summary of the service.
#
# chkconfig: 345 90 10
# description:	lp_server - export a printer by simulation a HP JetDirect interface
# processname: lp_server
# config: /etc/sysconfig/lp_server
# pidfile: /var/run/lp_server.pid

# Do not load RH compatibility interface.
WITHOUT_RC_COMPAT=1

# Source function library.
. /etc/init.d/functions

SourceIfNotEmpty /etc/sysconfig/lp_server

PIDFILE=/var/run/lp_server.pid
LOCKFILE=/var/lock/subsys/lp_server
RETVAL=0

start()
{	
	# --pidfile "$PIDFILE" 
	start_daemon --lockfile "$LOCKFILE" --expect-user lp -- lp_server -b ${PARAMS}
	RETVAL=$?
	return $RETVAL
}

stop()
{
	stop_daemon --pidfile "$PIDFILE" --lockfile "$LOCKFILE" -- lp_server
	RETVAL=$?
	return $RETVAL
}

restart()
{
	stop
	start
}

reload()
{
	restart
} 

# See how we were called.
case "$1" in
	start)
		start
		;;
	stop)
		stop
		;;
	reload)
		reload
		;;
	restart)
		restart
		;;
	condstop)
		if [ -e "$LOCKFILE" ]; then
			stop
		fi
		;;
	condrestart)
		if [ -e "$LOCKFILE" ]; then
			restart
		fi
		;;
	condreload)
		if [ -e "$LOCKFILE" ]; then
			reload
		fi
		;;
	status)
		status --pidfile "$PIDFILE" -- lp_server
		RETVAL=$?
		;;
	*)
		msg_usage "${0##*/} {start|stop|reload|restart|condstop|condrestart|condreload|status}"
		RETVAL=1
esac

exit $RETVAL
