]>
git.ipfire.org Git - thirdparty/cups.git/blob - scheduler/cups.sh.in
5 # Startup/shutdown script for CUPS.
7 # Copyright 2007-2011 by Apple Inc.
8 # Copyright 1997-2007 by Easy Software Products, all rights reserved.
10 # These coded instructions, statements, and computer programs are the
11 # property of Apple Inc. and are protected by Federal copyright
12 # law. Distribution and use rights are outlined in the file "LICENSE.txt"
13 # which should have been included with this file. If this file is
14 # file is missing or damaged, see the license at "http://www.cups.org/".
17 #### OS-Dependent Information
20 # Linux chkconfig stuff:
22 # chkconfig: 235 99 00
23 # description: Startup/shutdown script for CUPS.
27 # NetBSD 1.5+ rcorder script lines. The format of the following two
28 # lines is very strict -- please don't add additional spaces!
35 #### OS-Dependent Configuration
41 if $IS_ON verbose
; then
60 if test "${CUPS:=-YES-}" = "-NO-"; then
72 if test -f /etc
/init.d
/functions
; then
73 .
/etc
/init.d
/functions
75 ECHO_OK
="echo_success"
76 ECHO_ERROR
="echo_failure"
92 #### OS-Independent Stuff
95 # Set the timezone, if possible... This allows the scheduler and
96 # all child processes to know the local timezone when reporting
97 # dates and times to the user. If no timezone information is
98 # found, then Greenwich Mean Time (GMT) will probably be used.
101 for file in /etc
/TIMEZONE
/etc
/rc.config
/etc
/sysconfig
/clock; do
102 if test -f $file; then
107 if test "x$ZONE" != x
; then
111 if test "x$TIMEZONE" != x
; then
115 if test "x$TZ" != x
; then
120 # Don't use TMPDIR environment variable from init script, as that can
121 # cause cupsd to set TempDir to a user's temporary directory instead
129 # Make sure we have the standard program directories in the path
130 # since some operating systems (this means YOU HP-UX!) don't
131 # provide a standard path on boot-up...
134 if test "x$PATH" = x
; then
135 PATH
="/bin:/usr/bin:/sbin:/usr/sbin"
137 PATH
="/bin:/usr/bin:/sbin:/usr/sbin:$PATH"
143 # See if the CUPS server (cupsd) is running...
147 HP-UX
* | AIX
* | SINIX
*)
148 pid
=`ps -e | awk '{if (match($4, ".*/cupsd$") || $4 == "cupsd") print $1}'`
151 pid
=`ps -e | nawk '{if (match($4, ".*/cupsd$") || $4 == "cupsd") print $1}'`
154 pid
=`ps -e | awk '{if (match($6, ".*/cupsd$") || $6 == "cupsd") print $1}'`
158 pid
=`ps -e | awk '{if (match($5, ".*/cupsd$") || $5 == "cupsd") print $1}'`
160 Linux
* |
*BSD
* | Darwin
*)
161 pid
=`ps ax | awk '{if (match($5, ".*/cupsd$") || $5 == "cupsd") print $1}'`
169 # Start or stop the CUPS server based upon the first argument to the script.
173 start | restart | reload
)
175 if test -x /sbin
/portrelease
; then
176 /sbin
/portrelease cups
179 if test "$pid" != ""; then
183 exec_prefix
=@exec_prefix@
185 if test $?
!= 0; then
187 $ECHO "cups: unable to $1 scheduler."
192 $ECHO "cups: ${1}ed scheduler."
197 if test "$pid" != ""; then
200 $ECHO "cups: stopped scheduler."
205 if test "$pid" != ""; then
206 echo "cups: scheduler is running."
208 echo "cups: scheduler is not running."
213 # HP-UX non-standard...
214 echo "Starting CUPS Server"
218 # HP-UX non-standard...
219 echo "Starting CUPS Server"
223 echo "Usage: cups {reload|restart|start|status|stop}"
229 # Exit with no errors.