]>
git.ipfire.org Git - thirdparty/cups.git/blob - scheduler/cups.sh.in
3 # Startup/shutdown script for CUPS.
5 # Copyright © 2007-2013 by Apple Inc.
6 # Copyright © 1997-2007 by Easy Software Products, all rights reserved.
8 # Licensed under Apache License v2.0. See the file "LICENSE" for more
12 #### OS-Dependent Information
15 # Linux chkconfig stuff:
17 # chkconfig: 235 99 00
18 # description: Startup/shutdown script for CUPS.
22 # NetBSD 1.5+ rcorder script lines. The format of the following two
23 # lines is very strict -- please don't add additional spaces!
30 #### OS-Dependent Configuration
43 if test "${CUPS:=-YES-}" = "-NO-"; then
55 if test -f /etc
/init.d
/functions
; then
56 .
/etc
/init.d
/functions
58 ECHO_OK
="echo_success"
59 ECHO_ERROR
="echo_failure"
75 #### OS-Independent Stuff
78 # Set the timezone, if possible... This allows the scheduler and
79 # all child processes to know the local timezone when reporting
80 # dates and times to the user. If no timezone information is
81 # found, then Greenwich Mean Time (GMT) will probably be used.
84 for file in /etc
/TIMEZONE
/etc
/rc.config
/etc
/sysconfig
/clock; do
85 if test -f $file; then
90 if test "x$ZONE" != x
; then
94 if test "x$TIMEZONE" != x
; then
98 if test "x$TZ" != x
; then
103 # Don't use TMPDIR environment variable from init script, as that can
104 # cause cupsd to set TempDir to a user's temporary directory instead
112 # Make sure we have the standard program directories in the path
113 # since some operating systems don't provide a standard path on boot-up...
116 if test "x$PATH" = x
; then
117 PATH
="/bin:/usr/bin:/sbin:/usr/sbin"
119 PATH
="/bin:/usr/bin:/sbin:/usr/sbin:$PATH"
125 # See if the CUPS server (cupsd) is running...
130 pid
=`ps -e | nawk '{if (match($4, ".*/cupsd$") || $4 == "cupsd") print $1}'`
132 Linux
* |
*BSD
* | Darwin
*)
133 pid
=`ps ax | awk '{if (match($5, ".*/cupsd$") || $5 == "cupsd") print $1}'`
141 # Start or stop the CUPS server based upon the first argument to the script.
145 start | restart | reload
)
147 if test -x /sbin
/portrelease
; then
148 /sbin
/portrelease cups
151 if test "$pid" != ""; then
155 exec_prefix
=@exec_prefix@
157 if test $?
!= 0; then
159 $ECHO "cups: unable to $1 scheduler."
164 $ECHO "cups: ${1}ed scheduler."
169 if test "$pid" != ""; then
172 $ECHO "cups: stopped scheduler."
177 if test "$pid" != ""; then
178 echo "cups: scheduler is running."
180 echo "cups: scheduler is not running."
185 echo "Usage: cups {reload|restart|start|status|stop}"
191 # Exit with no errors.