]> git.ipfire.org Git - thirdparty/cups.git/blame - cups.sh.in
Copyright update.
[thirdparty/cups.git] / cups.sh.in
CommitLineData
1738443a 1#!/bin/sh
2#
1d9595ab 3# "$Id: cups.sh.in,v 1.9.2.8 2003/01/07 18:26:13 mike Exp $"
1738443a 4#
5# Startup/shutdown script for the Common UNIX Printing System (CUPS).
6#
1d9595ab 7# Copyright 1997-2003 by Easy Software Products, all rights reserved.
1738443a 8#
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
14# at:
15#
16# Attn: CUPS Licensing Information
17# Easy Software Products
520abe60 18# 44141 Airport View Drive, Suite 204
1738443a 19# Hollywood, Maryland 20636-3111 USA
20#
21# Voice: (301) 373-9603
22# EMail: cups-info@cups.org
23# WWW: http://www.cups.org
24#
25
4417c21b 26#### OS-Dependent Information
27
28#
29# Linux chkconfig stuff:
30#
b5cb0608 31# chkconfig: 235 99 00
4417c21b 32# description: Startup/shutdown script for the Common UNIX \
33# Printing System (CUPS).
34#
35
36#
37# NetBSD 1.5+ rcorder script lines. The format of the following two
38# lines is very strict -- please don't add additional spaces!
39#
40# PROVIDE: cups
41# REQUIRE: DAEMON
42#
43
44
45#### OS-Dependent Configuration
753453e4 46
a6bfa76f 47case "`uname`" in
a858353b 48 IRIX*)
a6bfa76f 49 IS_ON=/sbin/chkconfig
098f80c5 50
51 if $IS_ON verbose; then
52 ECHO=echo
53 else
54 ECHO=:
55 fi
56 ECHO_OK=:
57 ECHO_ERROR=:
a6bfa76f 58 ;;
59
339c1e92 60 *BSD*)
4417c21b 61 IS_ON=:
098f80c5 62 ECHO=echo
63 ECHO_OK=:
64 ECHO_ERROR=:
4417c21b 65 ;;
66
753453e4 67 Darwin*)
68 . /etc/rc.common
69
70 if test "${CUPS:=-YES-}" = "-NO-"; then
71 exit 0
72 fi
73
74 IS_ON=:
098f80c5 75 ECHO=ConsoleMessage
76 ECHO_OK=:
77 ECHO_ERROR=:
753453e4 78 ;;
79
80 Linux*)
753453e4 81 IS_ON=/bin/true
098f80c5 82 if test -f /etc/init.d/functions; then
83 . /etc/init.d/functions
84 ECHO=echo
85 ECHO_OK="echo_success"
86 ECHO_ERROR="echo_failure"
87 else
88 ECHO=echo
89 ECHO_OK=:
90 ECHO_ERROR=:
91 fi
753453e4 92 ;;
93
a6bfa76f 94 *)
95 IS_ON=/bin/true
098f80c5 96 ECHO=echo
97 ECHO_OK=:
98 ECHO_ERROR=:
a6bfa76f 99 ;;
100esac
101
4417c21b 102#### OS-Independent Stuff
103
098f80c5 104#
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.
110#
a0be9eaa 111
098f80c5 112for file in /etc/TIMEZONE /etc/rc.config /etc/sysconfig/clock; do
113 if test -f $file; then
114 . $file
a0be9eaa 115 fi
098f80c5 116done
a0be9eaa 117
098f80c5 118if test "x$ZONE" != x; then
119 TZ="$ZONE"
a0be9eaa 120fi
121
098f80c5 122if test "x$TIMEZONE" != x; then
123 TZ="$TIMEZONE"
124fi
4417c21b 125
098f80c5 126if test "x$TZ" != x; then
127 export TZ
a6bfa76f 128fi
129
4417c21b 130#
131# See if the CUPS server (cupsd) is running...
132#
133
1738443a 134case "`uname`" in
a0be9eaa 135 HP-UX* | AIX* | SINIX*)
753453e4 136 pid=`ps -e | awk '{if (match($4, ".*/cupsd$") || $4 == "cupsd") print $1}'`
137 ;;
a0be9eaa 138 IRIX* | SunOS*)
753453e4 139 pid=`ps -e | nawk '{if (match($4, ".*/cupsd$") || $4 == "cupsd") print $1}'`
140 ;;
141 UnixWare*)
142 pid=`ps -e | awk '{if (match($6, ".*/cupsd$") || $6 == "cupsd") print $1}'`
143 . /etc/TIMEZONE
1738443a 144 ;;
4417c21b 145 OSF1*)
753453e4 146 pid=`ps -e | awk '{if (match($5, ".*/cupsd$") || $5 == "cupsd") print $1}'`
1738443a 147 ;;
753453e4 148 Linux* | *BSD* | Darwin*)
149 pid=`ps ax | awk '{if (match($5, ".*/cupsd$") || $5 == "cupsd") print $1}'`
1738443a 150 ;;
151 *)
152 pid=""
153 ;;
154esac
155
4417c21b 156#
a6bfa76f 157# Start or stop the CUPS server based upon the first argument to the script.
4417c21b 158#
159
520abe60 160case $1 in
a6bfa76f 161 start | restart | reload)
b1d503b0 162 if $IS_ON cups; then
f3890b95 163 if test "$pid" != ""; then
164 kill -HUP $pid
165 else
166 prefix=@prefix@
167 exec_prefix=@exec_prefix@
168 @sbindir@/cupsd
098f80c5 169 if test $? != 0; then
170 $ECHO_FAIL
171 $ECHO "cups: unable to $1 scheduler."
172 exit 1
173 fi
f3890b95 174 fi
098f80c5 175 $ECHO_OK
176 $ECHO "cups: ${1}ed scheduler."
a6bfa76f 177 fi
178 ;;
c9e6a22c 179
520abe60 180 stop)
a6bfa76f 181 if test "$pid" != ""; then
182 kill $pid
098f80c5 183 $ECHO_OK
184 $ECHO "cups: stopped scheduler."
a6bfa76f 185 fi
186 ;;
187
188 status)
189 if test "$pid" != ""; then
098f80c5 190 echo "cups: scheduler is running."
a6bfa76f 191 else
098f80c5 192 echo "cups: scheduler is not running."
a6bfa76f 193 fi
194 ;;
195
196 *)
197 echo "Usage: cups {reload|restart|start|status|stop}"
198 exit 1
199 ;;
520abe60 200esac
1738443a 201
4417c21b 202#
203# Exit with no errors.
204#
205
a6bfa76f 206exit 0
207
208
1738443a 209#
1d9595ab 210# End of "$Id: cups.sh.in,v 1.9.2.8 2003/01/07 18:26:13 mike Exp $".
1738443a 211#