]> 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#
efb2f309 3# "$Id: cups.sh.in,v 1.17 2002/01/02 17:58:33 mike Exp $"
1738443a 4#
5# Startup/shutdown script for the Common UNIX Printing System (CUPS).
6#
efb2f309 7# Copyright 1997-2002 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#
4f2b7367 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
0e0ac99a 46
a6bfa76f 47case "`uname`" in
a858353b 48 IRIX*)
a6bfa76f 49 IS_ON=/sbin/chkconfig
50 ;;
51
4417c21b 52 NetBSD*)
53 IS_ON=:
54 ;;
55
0e0ac99a 56 Darwin*)
57 . /etc/rc.common
58
59 if test "${CUPS:=-YES-}" = "-NO-"; then
60 exit 0
61 fi
62
63 IS_ON=:
64 ;;
65
07ac19b7 66 Linux*)
67 # Set the timezone, if possible...
68 if test -f /etc/TIMEZONE; then
69 . /etc/TIMEZONE
70 else
71 if test -f /etc/sysconfig/clock; then
72 . /etc/sysconfig/clock
73 TZ="$ZONE"
74 export TZ
75 fi
76 fi
77
78 IS_ON=/bin/true
79 ;;
80
a6bfa76f 81 *)
82 IS_ON=/bin/true
83 ;;
84esac
85
4417c21b 86#### OS-Independent Stuff
87
88#
a6bfa76f 89# The verbose flag controls the printing of the names of
4417c21b 90# daemons as they are started. Currently always echos for
91# all but IRIX, which can configure verbose bootup messages.
92#
93
d53c2968 94if test "`uname`" = "Darwin"; then
0e0ac99a 95 ECHO=ConsoleMessage
a6bfa76f 96else
0e0ac99a 97 if $IS_ON verbose; then
98 ECHO=echo
99 else
100 ECHO=:
101 fi
a6bfa76f 102fi
103
4417c21b 104#
105# See if the CUPS server (cupsd) is running...
106#
107
1738443a 108case "`uname`" in
deb47268 109 IRIX* | HP-UX* | AIX* | SINIX*)
110 pid=`ps -e | awk '{if (match($4, ".*/cupsd$") || $4 == "cupsd") print $1}'`
111 ;;
112 SunOS*)
113 pid=`ps -e | nawk '{if (match($4, ".*/cupsd$") || $4 == "cupsd") print $1}'`
1738443a 114 ;;
b0ea5587 115 UnixWare*)
deb47268 116 pid=`ps -e | awk '{if (match($6, ".*/cupsd$") || $6 == "cupsd") print $1}'`
b0ea5587 117 . /etc/TIMEZONE
118 ;;
4417c21b 119 OSF1*)
deb47268 120 pid=`ps -e | awk '{if (match($5, ".*/cupsd$") || $5 == "cupsd") print $1}'`
1738443a 121 ;;
07ac19b7 122 Linux* | *BSD* | Darwin*)
deb47268 123 pid=`ps ax | awk '{if (match($5, ".*/cupsd$") || $5 == "cupsd") print $1}'`
1738443a 124 ;;
125 *)
126 pid=""
127 ;;
128esac
129
4417c21b 130#
a6bfa76f 131# Start or stop the CUPS server based upon the first argument to the script.
4417c21b 132#
133
520abe60 134case $1 in
a6bfa76f 135 start | restart | reload)
b1d503b0 136 if $IS_ON cups; then
f3890b95 137 if test "$pid" != ""; then
138 kill -HUP $pid
139 else
140 prefix=@prefix@
141 exec_prefix=@exec_prefix@
142 @sbindir@/cupsd
143 fi
b1d503b0 144 $ECHO "cups: scheduler ${1}ed."
a6bfa76f 145 else
b1d503b0 146 $ECHO "cups: scheduler stopped."
a6bfa76f 147 fi
148 ;;
c9e6a22c 149
520abe60 150 stop)
a6bfa76f 151 if test "$pid" != ""; then
152 kill $pid
153 $ECHO "cups: scheduler stopped."
154 fi
155 ;;
156
157 status)
158 if test "$pid" != ""; then
159 echo "cups: Scheduler is running."
160 else
161 echo "cups: Scheduler is not running."
162 fi
163 ;;
164
165 *)
166 echo "Usage: cups {reload|restart|start|status|stop}"
167 exit 1
168 ;;
520abe60 169esac
1738443a 170
4417c21b 171#
172# Exit with no errors.
173#
174
a6bfa76f 175exit 0
176
177
1738443a 178#
efb2f309 179# End of "$Id: cups.sh.in,v 1.17 2002/01/02 17:58:33 mike Exp $".
1738443a 180#