cvsdist afac77
#!/bin/sh
cvsdist afac77
#
cvsdist afac77
# "$Id: cups.sh,v 1.10 2000/03/30 05:19:16 mike Exp $"
cvsdist afac77
#
cvsdist afac77
#   Startup/shutdown script for the Common UNIX Printing System (CUPS).
cvsdist afac77
#
cvsdist afac77
#   Linux chkconfig stuff:
cvsdist afac77
#
Tim Waugh 5852cf
#   chkconfig: 2345 25 10
cvsdist afac77
#   description: Startup/shutdown script for the Common UNIX \
cvsdist afac77
#                Printing System (CUPS).
cvsdist afac77
#
cvsdist afac77
#   Copyright 1997-2000 by Easy Software Products, all rights reserved.
cvsdist afac77
#
cvsdist afac77
#   These coded instructions, statements, and computer programs are the
cvsdist afac77
#   property of Easy Software Products and are protected by Federal
cvsdist afac77
#   copyright law.  Distribution and use rights are outlined in the file
cvsdist afac77
#   "LICENSE.txt" which should have been included with this file.  If this
cvsdist afac77
#   file is missing or damaged please contact Easy Software Products
cvsdist afac77
#   at:
cvsdist afac77
#
cvsdist afac77
#       Attn: CUPS Licensing Information
cvsdist afac77
#       Easy Software Products
cvsdist afac77
#       44141 Airport View Drive, Suite 204
cvsdist afac77
#       Hollywood, Maryland 20636-3111 USA
cvsdist afac77
#
cvsdist afac77
#       Voice: (301) 373-9603
cvsdist afac77
#       EMail: cups-info@cups.org
cvsdist afac77
#         WWW: http://www.cups.org
cvsdist afac77
#
cvsdist afac77
# heavily edited so that it's more like other scripts in init.d on Red Hat
cvsdist afac77
# Linux
Tim Waugh 96ea82
#
Tim Waugh 96ea82
### BEGIN INIT INFO
Tim Waugh 96ea82
# Provides: cups
Tim Waugh 96ea82
# Required-Start: $syslog $local_fs
Tim Waugh 96ea82
# Required-Stop: $syslog $local_fs
Tim Waugh 96ea82
# Default-Start: 2 3 4 5
Tim Waugh 96ea82
# Default-Stop: 0 1 6
Tim Waugh 96ea82
# Short-Description: The CUPS scheduler
Tim Waugh 96ea82
# Description: The CUPS scheduler
Tim Waugh 96ea82
### END INIT INFO
cvsdist afac77
cvsdist afac77
# Source function library.
Tim Waugh 41fae3
. /etc/init.d/functions
cvsdist afac77
cvsdist afac77
DAEMON=cupsd
cvsdist afac77
cvsdist 051973
prog=cups
cvsdist 051973
cvsdist afac77
start () {
cvsdist 051973
	echo -n $"Starting $prog: "
cvsdist 051973
Tim Waugh 72452c
	# tell portreserve to release the port
Tim Waugh 72452c
	[ -x /sbin/portrelease ] && /sbin/portrelease cups &>/dev/null || :
Tim Waugh 72452c
cvsdist afac77
	# start daemon
cvsdist afac77
	daemon $DAEMON
cvsdist afac77
        RETVAL=$?
cvsdist afac77
	echo
cvsdist afac77
	[ $RETVAL = 0 ] && touch /var/lock/subsys/cups
Tim Waugh 4c0534
	return 0
cvsdist afac77
}
cvsdist afac77
cvsdist afac77
stop () {
cvsdist afac77
	# stop daemon
cvsdist 79dcdc
	echo -n $"Stopping $prog: "
cvsdist afac77
	killproc $DAEMON
cvsdist afac77
	RETVAL=$?
cvsdist afac77
	echo
cvsdist afac77
	[ $RETVAL = 0 ] && rm -f /var/lock/subsys/cups
Tim Waugh 4c0534
	return 0
cvsdist afac77
}
cvsdist afac77
cvsdist afac77
restart() {
cvsdist afac77
	stop
cvsdist afac77
	start
cvsdist afac77
}
cvsdist afac77
cvsdist afac77
case $1 in
cvsdist afac77
	start)
cvsdist afac77
		start
cvsdist afac77
	;;
cvsdist afac77
	stop)
cvsdist afac77
		stop
cvsdist afac77
	;;
cvsdist afac77
	restart)
cvsdist afac77
		restart
cvsdist afac77
	;;
Tim Waugh 4c0534
	condrestart|try-restart)
cvsdist fcbc17
		[ -f /var/lock/subsys/cups ] && restart || :
cvsdist afac77
	;;	
cvsdist 051973
	reload)
cvsdist 051973
		echo -n $"Reloading $prog: "
cvsdist 051973
		killproc $DAEMON -HUP
cvsdist 051973
		RETVAL=$?
cvsdist 051973
		echo
cvsdist 051973
	;;
Tim Waugh 4c0534
	force-reload)
Tim Waugh 4c0534
		echo -n $"Reloading $prog: "
Tim Waugh 4c0534
		if ! killproc $DAEMON -HUP; then
Tim Waugh 4c0534
			restart
Tim Waugh 4c0534
		fi
Tim Waugh 4c0534
		echo
Tim Waugh 4c0534
	;;
cvsdist afac77
	status)
cvsdist afac77
		status $DAEMON
Tim Waugh 41fae3
		RETVAL=$?
cvsdist afac77
	;;
Tim Waugh ea7be1
	restartlog)
Tim Waugh ea7be1
		stop
Tim Waugh ea7be1
		cat /dev/null >/var/log/cups/error_log
Tim Waugh ea7be1
		start
Tim Waugh ea7be1
	;;
cvsdist afac77
	*)
cvsdist afac77
cvsdist 79dcdc
	echo $"Usage: $prog {start|stop|restart|condrestart|reload|status}"
Tim Waugh 41fae3
	exit 3
cvsdist afac77
esac
cvsdist afac77
cvsdist afac77
exit $RETVAL