]>
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 |
48216a6a | 57 | msg_show CUPS |
58 | msg_reload | |
59 | busy | |
60 | killproc cupsd -HUP | |
61 | deltext | |
62 | ok | |
63 | else | |
44be047c | 64 | msg_not_running CUPS |
48216a6a | 65 | exit 1 |
66 | fi | |
67 | ;; | |
68 | force-reload) | |
69 | # if program allows reloading without stopping | |
70 | $0 reload | |
71 | exit $? | |
2f6a95a5 | 72 | |
48216a6a | 73 | # or if it doesn't |
74 | $0 stop && $0 start | |
75 | exit $? | |
76 | ;; | |
77 | status) | |
f6feb0d3 | 78 | status cupsd |
48216a6a | 79 | exit $? |
80 | ;; | |
81 | *) | |
82 | # show "Usage: %s {start|stop|status|restart|reload|force-reload}" $0 | |
44be047c | 83 | msg_usage "$0 {start|stop|status|restart|reload|force-reload}" |
48216a6a | 84 | exit 1 |
85 | esac | |
2f6a95a5 | 86 | |
48216a6a | 87 | exit $RETVAL |