File: PrintingServices

package info (click to toggle)
cupsys 1.2.7-4%2Betch9
  • links: PTS
  • area: main
  • in suites: etch
  • size: 20,436 kB
  • ctags: 10,404
  • sloc: ansic: 97,130; cpp: 49,167; java: 6,199; sh: 4,723; makefile: 1,918; lisp: 232; perl: 145; python: 119; php: 28
file content (45 lines) | stat: -rwxr-xr-x 965 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
#!/bin/sh

##
# PrintingServices - a.k.a. CUPS
##

. /etc/rc.common

StartService ()
{
	if [ "${CUPS:=-AUTOMATIC-}" = "-AUTOMATIC-" ]; then
		ConsoleMessage "Starting printing services"
		/usr/sbin/cupsd
	elif [ "${CUPS:=-AUTOMATIC-}" = "-YES-" ]; then
		ConsoleMessage "Starting printing services"
		/usr/sbin/cupsd
	fi
}

StopService ()
{
	# Until cupsd has a pid file...
	pid=`ps ax | awk '{if (match($5, ".*/cupsd$") || $5 == "cupsd") print $1}'`
	if test "$pid" != ""; then
		ConsoleMessage "Stopping printing services"
		kill "${pid}"
	fi
}

RestartService ()
{
	# Until cupsd has a pid file...
	pid=`ps ax | awk '{if (match($5, ".*/cupsd$") || $5 == "cupsd") print $1}'`
	if test "x$pid" != x; then
		ConsoleMessage "Restarting printing services"
		kill -HUP "${pid}"
	else
		if [ "${CUPS:=-AUTOMATIC-}" = "-AUTOMATIC-" -o "${CUPS:=-AUTOMATIC-}" = "-YES-" ]; then
			ConsoleMessage "Starting printing services"
			/usr/sbin/cupsd
		fi
	fi
}

RunService "$1"