net-dns/ddclient: use #!/sbin/openrc-run instead of #!/sbin/runscript
[gentoo.git] / net-dns / ddclient / files / ddclient.initd-r4
1 #!/sbin/openrc-run
2 # Copyright 1999-2014 Gentoo Foundation
3 # Distributed under the terms of the GNU General Public License v2
4 # $Id$
5
6 PIDFILE="/run/ddclient/ddclient.pid"
7
8 depend() {
9     before cron
10     need net
11     use dns logger squid
12 }
13
14 checkconfig() {
15     checkpath -f -m 0600 -o ddclient:ddclient /etc/ddclient/ddclient.conf || return 1
16     checkpath -d -m 0700 -o ddclient:ddclient /run/ddclient || return 1
17     checkpath -d -m 0700 -o ddclient:ddclient /var/cache/ddclient || return 1
18 }
19
20 start() {
21     checkconfig || return 1
22
23     ebegin "Starting ${SVCNAME}"
24     start-stop-daemon --start \
25         --user ddclient \
26         --name ddclient \
27         --pidfile ${PIDFILE} \
28         --exec /usr/sbin/ddclient -- -pid=${PIDFILE}
29     eend $?
30 }
31
32 stop() {
33     ebegin "Stopping ${SVCNAME}"
34     start-stop-daemon --stop --signal USR1 --pidfile ${PIDFILE}
35     eend $?
36 }