]> git.ipfire.org Git - thirdparty/cups.git/blame - cups.sh.in
Merge changes from 1.1 tree.
[thirdparty/cups.git] / cups.sh.in
CommitLineData
1738443a 1#!/bin/sh
2#
b5cb0608 3# "$Id: cups.sh.in,v 1.9.2.1 2001/05/13 18:37:58 mike Exp $"
1738443a 4#
5# Startup/shutdown script for the Common UNIX Printing System (CUPS).
6#
d2935a0f 7# Copyright 1997-2001 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
a6bfa76f 46case "`uname`" in
a858353b 47 IRIX*)
a6bfa76f 48 IS_ON=/sbin/chkconfig
49 ;;
50
4417c21b 51 NetBSD*)
52 IS_ON=:
53 ;;
54
a6bfa76f 55 *)
56 IS_ON=/bin/true
57 ;;
58esac
59
4417c21b 60#### OS-Independent Stuff
61
62#
a6bfa76f 63# The verbose flag controls the printing of the names of
4417c21b 64# daemons as they are started. Currently always echos for
65# all but IRIX, which can configure verbose bootup messages.
66#
67
a6bfa76f 68if $IS_ON verbose; then
69 ECHO=echo
70else
71 ECHO=:
72fi
73
4417c21b 74#
75# See if the CUPS server (cupsd) is running...
76#
77
1738443a 78case "`uname`" in
b5cb0608 79 IRIX* | HP-UX* | SunOS* | AIX*)
1738443a 80 pid=`ps -e | awk '{print $1,$4}' | grep cupsd | awk '{print $1}'`
81 ;;
4417c21b 82 OSF1*)
1738443a 83 pid=`ps -e | awk '{print $1,$5}' | grep cupsd | awk '{print $1}'`
84 ;;
4417c21b 85 Linux* | NetBSD*)
1738443a 86 pid=`ps ax | awk '{print $1,$5}' | grep cupsd | awk '{print $1}'`
87 ;;
88 *)
89 pid=""
90 ;;
91esac
92
4417c21b 93#
a6bfa76f 94# Start or stop the CUPS server based upon the first argument to the script.
4417c21b 95#
96
520abe60 97case $1 in
a6bfa76f 98 start | restart | reload)
b1d503b0 99 if $IS_ON cups; then
f3890b95 100 if test "$pid" != ""; then
101 kill -HUP $pid
102 else
103 prefix=@prefix@
104 exec_prefix=@exec_prefix@
105 @sbindir@/cupsd
106 fi
b1d503b0 107 $ECHO "cups: scheduler ${1}ed."
a6bfa76f 108 else
b1d503b0 109 $ECHO "cups: scheduler stopped."
a6bfa76f 110 fi
111 ;;
c9e6a22c 112
520abe60 113 stop)
a6bfa76f 114 if test "$pid" != ""; then
115 kill $pid
116 $ECHO "cups: scheduler stopped."
117 fi
118 ;;
119
120 status)
121 if test "$pid" != ""; then
122 echo "cups: Scheduler is running."
123 else
124 echo "cups: Scheduler is not running."
125 fi
126 ;;
127
128 *)
129 echo "Usage: cups {reload|restart|start|status|stop}"
130 exit 1
131 ;;
520abe60 132esac
1738443a 133
4417c21b 134#
135# Exit with no errors.
136#
137
a6bfa76f 138exit 0
139
140
1738443a 141#
b5cb0608 142# End of "$Id: cups.sh.in,v 1.9.2.1 2001/05/13 18:37:58 mike Exp $".
1738443a 143#