3 # "$Id: cups.sh.in 4493 2005-02-18 02:09:53Z mike $"
5 # Startup/shutdown script for the Common UNIX Printing System (CUPS).
7 # Copyright 1997-2005 by Easy Software Products, all rights reserved.
9 # These coded instructions, statements, and computer programs are the
10 # property of Easy Software Products and are protected by Federal
11 # copyright law. Distribution and use rights are outlined in the file
12 # "LICENSE.txt" which should have been included with this file. If this
13 # file is missing or damaged please contact Easy Software Products
16 # Attn: CUPS Licensing Information
17 # Easy Software Products
18 # 44141 Airport View Drive, Suite 204
19 # Hollywood, Maryland 20636 USA
21 # Voice: (301) 373-9600
22 # EMail: cups-info@cups.org
23 # WWW: http://www.cups.org
26 #### OS-Dependent Information
29 # Linux chkconfig stuff:
31 # chkconfig: 235 99 00
32 # description: Startup/shutdown script for the Common UNIX \
33 # Printing System (CUPS).
37 # NetBSD 1.5+ rcorder script lines. The format of the following two
38 # lines is very strict -- please don't add additional spaces!
45 #### OS-Dependent Configuration
51 if $IS_ON verbose; then
70 if test "${CUPS:=-YES-}" = "-NO-"; then
82 if test -f /etc/init.d/functions; then
83 . /etc/init.d/functions
85 ECHO_OK="echo_success"
86 ECHO_ERROR="echo_failure"
102 #### OS-Independent Stuff
105 # Set the timezone, if possible... This allows the
106 # scheduler and all child processes to know the local
107 # timezone when reporting dates and times to the user.
108 # If no timezone information is found, then Greenwich
109 # Mean Time (GMT) will probably be used.
112 for file in /etc/TIMEZONE /etc/rc.config /etc/sysconfig/clock; do
113 if test -f $file; then
118 if test "x$ZONE" != x; then
122 if test "x$TIMEZONE" != x; then
126 if test "x$TZ" != x; then
131 # See if the CUPS server (cupsd) is running...
135 HP-UX* | AIX* | SINIX*)
136 pid=`ps -e | awk '{if (match($4, ".*/cupsd$") || $4 == "cupsd") print $1}'`
139 pid=`ps -e | nawk '{if (match($4, ".*/cupsd$") || $4 == "cupsd") print $1}'`
142 pid=`ps -e | awk '{if (match($6, ".*/cupsd$") || $6 == "cupsd") print $1}'`
146 pid=`ps -e | awk '{if (match($5, ".*/cupsd$") || $5 == "cupsd") print $1}'`
148 Linux* | *BSD* | Darwin*)
149 pid=`ps ax | awk '{if (match($5, ".*/cupsd$") || $5 == "cupsd") print $1}'`
157 # Start or stop the CUPS server based upon the first argument to the script.
161 start | restart | reload)
163 if test "$pid" != ""; then
167 exec_prefix=@exec_prefix@
169 if test $? != 0; then
171 $ECHO "cups: unable to $1 scheduler."
176 $ECHO "cups: ${1}ed scheduler."
181 if test "$pid" != ""; then
184 $ECHO "cups: stopped scheduler."
189 if test "$pid" != ""; then
190 echo "cups: scheduler is running."
192 echo "cups: scheduler is not running."
197 echo "Usage: cups {reload|restart|start|status|stop}"
203 # Exit with no errors.
210 # End of "$Id: cups.sh.in 4493 2005-02-18 02:09:53Z mike $".