]>
Commit | Line | Data |
---|---|---|
2f6a95a5 | 1 | #!/bin/sh |
2 | # | |
2f6a95a5 | 3 | # |
48216a6a | 4 | # cups Common UNIX Printing System (CUPS) |
2f6a95a5 | 5 | # |
17b43d09 | 6 | # chkconfig: 235 95 00 |
48216a6a | 7 | # description: Startup/shutdown script for the Common UNIX \ |
8 | # Printing System (CUPS). | |
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. |
21 | if is_no "${NETWORKING}"; then | |
44be047c | 22 | msg_network_down CUPS |
48216a6a | 23 | exit 1 |
24 | fi | |
2f6a95a5 | 25 | |
48216a6a | 26 | # See how we were called. |
27 | case "$1" in | |
28 | start) | |
29 | # Check if the service is already running? | |
f6feb0d3 | 30 | if [ ! -f /var/lock/subsys/cupsd ]; then |
48216a6a | 31 | msg_starting CUPS |
78986dfa | 32 | daemon cupsd -c /etc/cups/cupsd.conf |
48216a6a | 33 | RETVAL=$? |
f6feb0d3 | 34 | [ $RETVAL -eq 0 ] && touch /var/lock/subsys/cupsd |
48216a6a | 35 | else |
44be047c | 36 | msg_already_running CUPS |
2f6a95a5 | 37 | exit 1 |
48216a6a | 38 | fi |
39 | ;; | |
40 | stop) | |
41 | # Stop daemons. | |
f6feb0d3 | 42 | if [ -f /var/lock/subsys/cupsd ]; then |
48216a6a | 43 | msg_stopping CUPS |
44 | killproc cupsd | |
f6feb0d3 | 45 | rm -f /var/lock/subsys/cupsd >/dev/null 2>&1 |
48216a6a | 46 | else |
44be047c | 47 | msg_not_running CUPS |
48216a6a | 48 | exit 1 |
49 | fi | |
50 | ;; | |
51 | restart) | |
52 | $0 stop | |
53 | $0 start | |
54 | ;; | |
55 | reload) | |
f6feb0d3 | 56 | if [ -f /var/lock/subsys/cupsd ]; then |
e5676d4c | 57 | msg_reloading CUPS |
48216a6a | 58 | busy |
59 | killproc cupsd -HUP | |
48216a6a | 60 | else |
44be047c | 61 | msg_not_running CUPS |
48216a6a | 62 | exit 1 |
63 | fi | |
64 | ;; | |
65 | force-reload) | |
66 | # if program allows reloading without stopping | |
67 | $0 reload | |
68 | exit $? | |
2f6a95a5 | 69 | |
48216a6a | 70 | # or if it doesn't |
71 | $0 stop && $0 start | |
72 | exit $? | |
73 | ;; | |
74 | status) | |
f6feb0d3 | 75 | status cupsd |
48216a6a | 76 | exit $? |
77 | ;; | |
78 | *) | |
79 | # show "Usage: %s {start|stop|status|restart|reload|force-reload}" $0 | |
44be047c | 80 | msg_usage "$0 {start|stop|status|restart|reload|force-reload}" |
48216a6a | 81 | exit 1 |
82 | esac | |
2f6a95a5 | 83 | |
48216a6a | 84 | exit $RETVAL |