]> git.pld-linux.org Git - packages/cups.git/blame - cups.init
- release 4
[packages/cups.git] / cups.init
CommitLineData
2f6a95a5 1#!/bin/sh
2#
48216a6a 3# cups Common UNIX Printing System (CUPS)
2f6a95a5 4#
2549056c 5# chkconfig: 2345 90 10
48216a6a 6# description: Startup/shutdown script for the Common UNIX \
7# Printing System (CUPS).
558087cd 8# processname: cupsd
2f6a95a5 9#
10
48216a6a 11# Source function library
12. /etc/rc.d/init.d/functions
2f6a95a5 13
48216a6a 14# Get network config
15. /etc/sysconfig/network
2f6a95a5 16
48216a6a 17# Get service config - may override defaults
18[ -f /etc/sysconfig/cups ] && . /etc/sysconfig/cups
2f6a95a5 19
48216a6a 20# Check that networking is up.
b4cbd825 21if is_yes "${NETWORKING}"; then
e53ab601 22 if [ ! -f /var/lock/subsys/network -a "$1" != stop -a "$1" != status ]; then
b4cbd825 23 msg_network_down CUPS
24 exit 1
25 fi
26else
27 exit 0
48216a6a 28fi
2f6a95a5 29
aeb8706d 30start() {
48216a6a 31 # Check if the service is already running?
4070cf70 32 if [ ! -f /var/lock/subsys/cups ]; then
48216a6a 33 msg_starting CUPS
00e5b777 34 daemon /usr/sbin/cupsd -c /etc/cups/cupsd.conf
48216a6a 35 RETVAL=$?
4070cf70 36 [ $RETVAL -eq 0 ] && touch /var/lock/subsys/cups
48216a6a 37 else
44be047c 38 msg_already_running CUPS
48216a6a 39 fi
aeb8706d
ER
40}
41
42stop() {
5995ec5d 43 # Stop daemons.
4070cf70 44 if [ -f /var/lock/subsys/cups ]; then
48216a6a 45 msg_stopping CUPS
46 killproc cupsd
4070cf70 47 rm -f /var/lock/subsys/cups >/dev/null 2>&1
48216a6a 48 else
44be047c 49 msg_not_running CUPS
035f0970 50 fi
aeb8706d
ER
51}
52
53RETVAL=0
54# See how we were called.
55case "$1" in
56 start)
57 start
58 ;;
59 stop)
60 stop
5995ec5d 61 ;;
48216a6a 62 restart)
aeb8706d
ER
63 stop
64 start
5995ec5d 65 ;;
26e4a0de 66 reload|force-reload)
4070cf70 67 if [ -f /var/lock/subsys/cups ]; then
e5676d4c 68 msg_reloading CUPS
48216a6a 69 killproc cupsd -HUP
b4cbd825 70 RETVAL=$?
48216a6a 71 else
f10dd802 72 msg_not_running CUPS
26e4a0de 73 exit 7
48216a6a 74 fi
75 ;;
48216a6a 76 status)
0f02d80d 77 status cups cupsd
48216a6a 78 exit $?
5995ec5d 79 ;;
48216a6a 80 *)
5995ec5d 81 msg_usage "$0 {start|stop|restart|reload|force-reload|status}"
26e4a0de 82 exit 3
48216a6a 83esac
2f6a95a5 84
48216a6a 85exit $RETVAL
This page took 0.181783 seconds and 4 git commands to generate.