]>
Commit | Line | Data |
---|---|---|
2f6a95a5 | 1 | #!/bin/sh |
2 | # | |
2f6a95a5 | 3 | # |
48216a6a | 4 | # cups Common UNIX Printing System (CUPS) |
2f6a95a5 | 5 | # |
48216a6a | 6 | # chkconfig: 0235 99 00 |
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 | |
22 | msg_Network_Down CUPS | |
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? | |
30 | if [ ! -f /var/lock/subsys/cups ]; then | |
31 | msg_starting CUPS | |
e95b780e | 32 | daemon cupsd -c /etc/cups/cups.conf |
48216a6a | 33 | RETVAL=$? |
34 | [ $RETVAL -eq 0 ] && touch /var/lock/subsys/cups | |
35 | else | |
36 | msg_Already_Running CUPS | |
2f6a95a5 | 37 | exit 1 |
48216a6a | 38 | fi |
39 | ;; | |
40 | stop) | |
41 | # Stop daemons. | |
42 | if [ -f /var/lock/subsys/cups ]; then | |
43 | msg_stopping CUPS | |
44 | killproc cupsd | |
45 | rm -f /var/lock/subsys/cups >/dev/null 2>&1 | |
46 | else | |
47 | msg_Not_Running CUPS | |
48 | exit 1 | |
49 | fi | |
50 | ;; | |
51 | restart) | |
52 | $0 stop | |
53 | $0 start | |
54 | ;; | |
55 | reload) | |
56 | if [ -f /var/lock/subsys/cups ]; then | |
57 | msg_show CUPS | |
58 | msg_reload | |
59 | busy | |
60 | killproc cupsd -HUP | |
61 | deltext | |
62 | ok | |
63 | else | |
64 | msg_Not_Running CUPS | |
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) | |
78 | status cups | |
79 | exit $? | |
80 | ;; | |
81 | *) | |
82 | # show "Usage: %s {start|stop|status|restart|reload|force-reload}" $0 | |
83 | msg_Usage "$0 {start|stop|status|restart|reload|force-reload}" | |
84 | exit 1 | |
85 | esac | |
2f6a95a5 | 86 | |
48216a6a | 87 | exit $RETVAL |