Subversion Repositories configs

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
4 - 1
#!/bin/sh
2
#
3
# "$Id: cups.sh,v 1.10 2000/03/30 05:19:16 mike Exp $"
4
#
5
#   Startup/shutdown script for the Common UNIX Printing System (CUPS).
6
#
7
#   Linux chkconfig stuff:
8
#
9
#   chkconfig: 2345 25 10
10
#   description: Startup/shutdown script for the Common UNIX \
11
#                Printing System (CUPS).
12
#
13
#   Copyright 1997-2000 by Easy Software Products, all rights reserved.
14
#
15
#   These coded instructions, statements, and computer programs are the
16
#   property of Easy Software Products and are protected by Federal
17
#   copyright law.  Distribution and use rights are outlined in the file
18
#   "LICENSE.txt" which should have been included with this file.  If this
19
#   file is missing or damaged please contact Easy Software Products
20
#   at:
21
#
22
#       Attn: CUPS Licensing Information
23
#       Easy Software Products
24
#       44141 Airport View Drive, Suite 204
25
#       Hollywood, Maryland 20636-3111 USA
26
#
27
#       Voice: (301) 373-9603
28
#       EMail: cups-info@cups.org
29
#         WWW: http://www.cups.org
30
#
31
# heavily edited so that it's more like other scripts in init.d on Red Hat
32
# Linux
33
#
34
### BEGIN INIT INFO
35
# Provides: cups
36
# Required-Start: $syslog $local_fs
37
# Required-Stop: $syslog $local_fs
38
# Should-Start: portreserve
39
# Default-Start: 2 3 4 5
40
# Default-Stop: 0 1 6
41
# Short-Description: The CUPS scheduler
42
# Description: The CUPS scheduler
43
### END INIT INFO
44
 
45
# Source function library.
46
. /etc/rc.d/init.d/functions
47
 
48
[ -f /etc/sysconfig/cups ] && . /etc/sysconfig/cups
49
 
50
DAEMON=cupsd
51
exec=/usr/sbin/cupsd
52
prog=cups
53
config=/etc/cups/cupsd.conf
54
lockfile=/var/lock/subsys/cups
55
 
56
check() {
57
	# Check that we're a privileged user
58
	[ `id -u` = 0 ] || exit 4
59
 
60
	# Check if cupsd is executable
61
	[ -x $exec ] || exit 5
62
}
63
 
64
start () {
65
	check
66
	[ -f $config ] || exit 6
67
 
68
	echo -n $"Starting $prog: "
69
 
70
	# tell portreserve to release the port
71
	[ -x /sbin/portrelease ] && /sbin/portrelease cups &>/dev/null || :
72
 
73
	# start daemon
74
	daemon $DAEMON
75
        RETVAL=$?
76
	echo
77
	[ $RETVAL = 0 ] && touch $lockfile
78
 
79
	udevadm trigger --subsystem-match=usb	\
80
		--attr-match=bInterfaceClass=07	\
81
		--attr-match=bInterfaceSubClass=01 &>/dev/null || :
82
        udevadm trigger --subsystem-match=usb \
83
		--property-match=DEVNAME="/dev/usb/lp*" &>/dev/null || :
84
 
85
	return 0
86
}
87
 
88
stop () {
89
	check
90
 
91
	# stop daemon
92
	echo -n $"Stopping $prog: "
93
	killproc $DAEMON
94
	RETVAL=$?
95
	echo
96
	[ $RETVAL = 0 ] && rm -f $lockfile
97
	return 0
98
}
99
 
100
restart() {
101
	stop
102
	start
103
}
104
 
105
case $1 in
106
	start)
107
		start
108
	;;
109
	stop)
110
		stop
111
	;;
112
	restart)
113
		restart
114
	;;
115
	condrestart|try-restart)
116
		[ -f $lockfile ] && restart || :
117
	;;
118
	reload)
119
		echo -n $"Reloading $prog: "
120
		killproc $DAEMON -HUP
121
		RETVAL=$?
122
		echo
123
	;;
124
	force-reload)
125
		echo -n $"Reloading $prog: "
126
		if ! killproc $DAEMON -HUP; then
127
			restart
128
		fi
129
		echo
130
	;;
131
	status)
132
		status -l $(basename $lockfile) $DAEMON
133
		RETVAL=$?
134
	;;
135
	restartlog)
136
		stop
137
		cat /dev/null >/var/log/cups/error_log
138
		start
139
	;;
140
	*)
141
 
142
	echo $"Usage: $prog {start|stop|restart|restartlog|condrestart|try-restart|reload|force-reload|status}"
143
	exit 2
144
esac
145
 
146
exit $RETVAL