]>
Commit | Line | Data |
---|---|---|
2f6a95a5 | 1 | #!/bin/sh |
2 | # | |
3 | # "$Id$" | |
4 | # | |
5 | # Startup/shutdown script for the Common UNIX Printing System (CUPS). | |
6 | # | |
7 | # Linux chkconfig stuff: | |
8 | # | |
9 | # chkconfig: 0235 99 00 | |
10 | # description: Startup/shutdown script for the Common UNIX \ | |
11 | # Printing System (CUPS). | |
12 | # | |
13 | # Copyright 1997-2000 by Easy Software Products, all rights reserved. | |
14 | # | |
15 | # These coded instructions, statements, and computer programs are the | |
16 | # property of Easy Software Products and are protected by Federal | |
17 | # copyright law. Distribution and use rights are outlined in the file | |
18 | # "LICENSE.txt" which should have been included with this file. If this | |
19 | # file is missing or damaged please contact Easy Software Products | |
20 | # at: | |
21 | # | |
22 | # Attn: CUPS Licensing Information | |
23 | # Easy Software Products | |
24 | # 44141 Airport View Drive, Suite 204 | |
25 | # Hollywood, Maryland 20636-3111 USA | |
26 | # | |
27 | # Voice: (301) 373-9603 | |
28 | # EMail: cups-info@cups.org | |
29 | # WWW: http://www.cups.org | |
30 | # | |
31 | ||
32 | # See what program to use for configuration stuff... | |
33 | case "`uname`" in | |
34 | IRIX*) | |
35 | IS_ON=/sbin/chkconfig | |
36 | ;; | |
37 | ||
38 | *) | |
39 | IS_ON=/bin/true | |
40 | ;; | |
41 | esac | |
42 | ||
43 | # The verbose flag controls the printing of the names of | |
44 | # daemons as they are started. | |
45 | if $IS_ON verbose; then | |
46 | ECHO=echo | |
47 | else | |
48 | ECHO=: | |
49 | fi | |
50 | ||
51 | # See if the CUPS server is running... | |
52 | case "`uname`" in | |
53 | IRIX* | HP-UX | SunOS) | |
54 | pid=`ps -e | awk '{print $1,$4}' | grep cupsd | awk '{print $1}'` | |
55 | ;; | |
56 | OSF1) | |
57 | pid=`ps -e | awk '{print $1,$5}' | grep cupsd | awk '{print $1}'` | |
58 | ;; | |
59 | Linux) | |
60 | pid=`ps ax | awk '{print $1,$5}' | grep cupsd | awk '{print $1}'` | |
61 | ;; | |
62 | *) | |
63 | pid="" | |
64 | ;; | |
65 | esac | |
66 | ||
67 | # Start or stop the CUPS server based upon the first argument to the script. | |
68 | case $1 in | |
69 | start | restart | reload) | |
70 | if test "$pid" != ""; then | |
71 | if $IS_ON cups; then | |
72 | kill -HUP $pid | |
73 | $ECHO "cups: scheduler restarted." | |
74 | else | |
75 | kill $pid | |
76 | $ECHO "cups: scheduler stopped." | |
77 | fi | |
78 | else | |
79 | if $IS_ON cups; then | |
80 | prefix=/usr | |
81 | exec_prefix=/usr | |
82 | /usr/sbin/cupsd | |
83 | $ECHO "cups: scheduler started." | |
84 | fi | |
85 | fi | |
86 | ;; | |
87 | ||
88 | stop) | |
89 | if test "$pid" != ""; then | |
90 | kill $pid | |
91 | $ECHO "cups: scheduler stopped." | |
92 | fi | |
93 | ;; | |
94 | ||
95 | status) | |
96 | if test "$pid" != ""; then | |
97 | echo "cups: Scheduler is running." | |
98 | else | |
99 | echo "cups: Scheduler is not running." | |
100 | fi | |
101 | ;; | |
102 | ||
103 | *) | |
104 | echo "Usage: cups {reload|restart|start|status|stop}" | |
105 | exit 1 | |
106 | ;; | |
107 | esac | |
108 | ||
109 | exit 0 | |
110 | ||
111 | ||
112 | # | |
113 | # End of "$Id$". | |
114 | # |