aboutsummaryrefslogtreecommitdiffstats
path: root/main/cups/cupsd.initd
blob: ff099878426990b34140968eccabc129a675fc78 (plain)
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
#!/sbin/openrc-run

name="CUPS"

extra_commands="checkconfig"
extra_started_commands="reload"

description_checkconfig="Test the configuration file"
description_reload="Reload"

: ${cfgfile:="/etc/cups/cupsd.conf"}

command="/usr/sbin/cupsd"
command_args="-f -c $cfgfile"
command_background="yes"

pidfile="/run/cups/$RC_SVCNAME.pid"

depend() {
	use net
	before nfs
	need dbus
	after logger
}

checkconfig() {
	$command $command_args -t >/dev/null 2>&1 \
		|| $command $command_args -t
}

start_pre() {
	checkconfig || return 1

	checkpath -q -d -m 0775 -o root:lp /var/cache/cups
	checkpath -q -d -m 0775 -o root:lp /var/cache/cups/rss
	checkpath -q -d -m 0755 -o root:lp /run/cups
	checkpath -q -d -m 0511 -o lp:lpadmin /run/cups/certs
}

reload() {
	ebegin "Reloading $name"
	start-stop-daemon --signal HUP --pidfile "$pidfile"
	eend $?
}