]> git.ipfire.org Git - thirdparty/cups.git/blame - scheduler/cups.sh.in
Remove all of the Subversion keywords from various source files.
[thirdparty/cups.git] / scheduler / cups.sh.in
CommitLineData
ef416fc2 1#!/bin/sh
2#
5a1d7a17 3# Startup/shutdown script for CUPS.
ef416fc2 4#
5a1d7a17
MS
5# Copyright 2007-2013 by Apple Inc.
6# Copyright 1997-2007 by Easy Software Products, all rights reserved.
ef416fc2 7#
5a1d7a17
MS
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/".
ef416fc2 13#
14
15#### OS-Dependent Information
16
17#
18# Linux chkconfig stuff:
19#
20# chkconfig: 235 99 00
321d8d57 21# description: Startup/shutdown script for CUPS.
ef416fc2 22#
23
24#
25# NetBSD 1.5+ rcorder script lines. The format of the following two
26# lines is very strict -- please don't add additional spaces!
27#
28# PROVIDE: cups
29# REQUIRE: DAEMON
30#
31
32
33#### OS-Dependent Configuration
34
35case "`uname`" in
ef416fc2 36 *BSD*)
37 IS_ON=:
38 ECHO=echo
39 ECHO_OK=:
40 ECHO_ERROR=:
41 ;;
42
43 Darwin*)
44 . /etc/rc.common
45
46 if test "${CUPS:=-YES-}" = "-NO-"; then
47 exit 0
48 fi
49
50 IS_ON=:
51 ECHO=ConsoleMessage
52 ECHO_OK=:
53 ECHO_ERROR=:
54 ;;
55
56 Linux*)
57 IS_ON=/bin/true
58 if test -f /etc/init.d/functions; then
59 . /etc/init.d/functions
60 ECHO=echo
61 ECHO_OK="echo_success"
62 ECHO_ERROR="echo_failure"
63 else
64 ECHO=echo
65 ECHO_OK=:
66 ECHO_ERROR=:
67 fi
68 ;;
69
70 *)
71 IS_ON=/bin/true
72 ECHO=echo
73 ECHO_OK=:
74 ECHO_ERROR=:
75 ;;
76esac
77
78#### OS-Independent Stuff
79
80#
bd7854cb 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.
ef416fc2 85#
86
87for file in /etc/TIMEZONE /etc/rc.config /etc/sysconfig/clock; do
88 if test -f $file; then
89 . $file
90 fi
91done
92
93if test "x$ZONE" != x; then
94 TZ="$ZONE"
95fi
96
97if test "x$TIMEZONE" != x; then
98 TZ="$TIMEZONE"
99fi
100
101if test "x$TZ" != x; then
102 export TZ
103fi
104
bd7854cb 105#
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
108# of the default...
109#
110
111unset TMPDIR
112
113
f7deaa1a 114#
115# Make sure we have the standard program directories in the path
5a1d7a17 116# since some operating systems don't provide a standard path on boot-up...
f7deaa1a 117#
118
7594b224 119if test "x$PATH" = x; then
f7deaa1a 120 PATH="/bin:/usr/bin:/sbin:/usr/sbin"
121else
122 PATH="/bin:/usr/bin:/sbin:/usr/sbin:$PATH"
123fi
124
125export PATH
126
ef416fc2 127#
128# See if the CUPS server (cupsd) is running...
129#
130
131case "`uname`" in
3dd9c340 132 SunOS*)
ef416fc2 133 pid=`ps -e | nawk '{if (match($4, ".*/cupsd$") || $4 == "cupsd") print $1}'`
134 ;;
ef416fc2 135 Linux* | *BSD* | Darwin*)
136 pid=`ps ax | awk '{if (match($5, ".*/cupsd$") || $5 == "cupsd") print $1}'`
137 ;;
138 *)
139 pid=""
140 ;;
141esac
142
143#
144# Start or stop the CUPS server based upon the first argument to the script.
145#
146
147case $1 in
148 start | restart | reload)
149 if $IS_ON cups; then
85dda01c
MS
150 if test -x /sbin/portrelease; then
151 /sbin/portrelease cups
152 fi
153
ef416fc2 154 if test "$pid" != ""; then
155 kill -HUP $pid
156 else
157 prefix=@prefix@
158 exec_prefix=@exec_prefix@
159 @sbindir@/cupsd
160 if test $? != 0; then
161 $ECHO_FAIL
162 $ECHO "cups: unable to $1 scheduler."
163 exit 1
164 fi
165 fi
166 $ECHO_OK
167 $ECHO "cups: ${1}ed scheduler."
168 fi
169 ;;
170
171 stop)
172 if test "$pid" != ""; then
173 kill $pid
174 $ECHO_OK
175 $ECHO "cups: stopped scheduler."
176 fi
177 ;;
178
179 status)
180 if test "$pid" != ""; then
181 echo "cups: scheduler is running."
182 else
183 echo "cups: scheduler is not running."
184 fi
185 ;;
186
187 *)
188 echo "Usage: cups {reload|restart|start|status|stop}"
189 exit 1
190 ;;
191esac
192
193#
194# Exit with no errors.
195#
196
197exit 0