1#!/sbin/openrc-run
2
3name="CUPS"
4
5extra_commands="checkconfig"
6extra_started_commands="reload"
7
8description_checkconfig="Test the configuration file"
9description_reload="Reload"
10
11: ${cfgfile:="/etc/cups/cupsd.conf"}
12
13command="/usr/sbin/cupsd"
14command_args="-f -c $cfgfile"
15command_background="yes"
16
17pidfile="/run/cups/$RC_SVCNAME.pid"
18
19depend() {
20 use net
21 before nfs
22 after logger
23}
24
25checkconfig() {
26 $command $command_args -t >/dev/null 2>&1 \
27 || $command $command_args -t
28}
29
30start_pre() {
31 checkconfig || return 1
32
33 checkpath -q -d -m 0775 -o root:lp /var/cache/cups
34 checkpath -q -d -m 0775 -o root:lp /var/cache/cups/rss
35 checkpath -q -d -m 0755 -o root:lp /run/cups
36 checkpath -q -d -m 0511 -o lp:lpadmin /run/cups/certs
37}
38
39reload() {
40 ebegin "Reloading $name"
41 start-stop-daemon --signal HUP --pidfile "$pidfile"
42 eend $?
43}