]>
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 # These coded instructions, statements, and computer programs are the
9 # property of Apple Inc. and are protected by Federal copyright
10 # law. Distribution and use rights are outlined in the file "LICENSE.txt"
11 # which should have been included with this file. If this file is
12 # file is missing or damaged, see the license at "http://www.cups.org/".
15 #### OS-Dependent Information
18 # Linux chkconfig stuff:
20 # chkconfig: 235 99 00
21 # description: Startup/shutdown script for CUPS.
25 # NetBSD 1.5+ rcorder script lines. The format of the following two
26 # lines is very strict -- please don't add additional spaces!
33 #### OS-Dependent Configuration
46 if test "${CUPS:=-YES-}" = "-NO-"; then
58 if test -f /etc
/init.d
/functions
; then
59 .
/etc
/init.d
/functions
61 ECHO_OK
="echo_success"
62 ECHO_ERROR
="echo_failure"
78 #### OS-Independent Stuff
81 # Set the timezone, if possible... This allows the scheduler and
82 # all child processes to know the local timezone when reporting
83 # dates and times to the user. If no timezone information is
84 # found, then Greenwich Mean Time (GMT) will probably be used.
87 for file in /etc
/TIMEZONE
/etc
/rc.config
/etc
/sysconfig
/clock; do
88 if test -f $file; then
93 if test "x$ZONE" != x
; then
97 if test "x$TIMEZONE" != x
; then
101 if test "x$TZ" != x
; then
106 # Don't use TMPDIR environment variable from init script, as that can
107 # cause cupsd to set TempDir to a user's temporary directory instead
115 # Make sure we have the standard program directories in the path
116 # since some operating systems don't provide a standard path on boot-up...
119 if test "x$PATH" = x
; then
120 PATH
="/bin:/usr/bin:/sbin:/usr/sbin"
122 PATH
="/bin:/usr/bin:/sbin:/usr/sbin:$PATH"
128 # See if the CUPS server (cupsd) is running...
133 pid
=`ps -e | nawk '{if (match($4, ".*/cupsd$") || $4 == "cupsd") print $1}'`
135 Linux
* |
*BSD
* | Darwin
*)
136 pid
=`ps ax | awk '{if (match($5, ".*/cupsd$") || $5 == "cupsd") print $1}'`
144 # Start or stop the CUPS server based upon the first argument to the script.
148 start | restart | reload
)
150 if test -x /sbin
/portrelease
; then
151 /sbin
/portrelease cups
154 if test "$pid" != ""; then
158 exec_prefix
=@exec_prefix@
160 if test $?
!= 0; then
162 $ECHO "cups: unable to $1 scheduler."
167 $ECHO "cups: ${1}ed scheduler."
172 if test "$pid" != ""; then
175 $ECHO "cups: stopped scheduler."
180 if test "$pid" != ""; then
181 echo "cups: scheduler is running."
183 echo "cups: scheduler is not running."
188 echo "Usage: cups {reload|restart|start|status|stop}"
194 # Exit with no errors.