summaryrefslogtreecommitdiff
blob: e342e2532e29d126cc041a881ccb768d0be3affd (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
#!/sbin/openrc-run
# Copyright 1999-2014 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Id$

PIDFILE="/run/ddclient/ddclient.pid"

depend() {
    before cron
    need net
    use dns logger squid
}

checkconfig() {
    checkpath -f -m 0600 -o ddclient:ddclient /etc/ddclient/ddclient.conf || return 1
    checkpath -d -m 0700 -o ddclient:ddclient /run/ddclient || return 1
    checkpath -d -m 0700 -o ddclient:ddclient /var/cache/ddclient || return 1
}

start() {
    checkconfig || return 1

    ebegin "Starting ${SVCNAME}"
    start-stop-daemon --start \
        --user ddclient \
	--name ddclient \
        --pidfile ${PIDFILE} \
        --exec /usr/sbin/ddclient -- -pid=${PIDFILE}
    eend $?
}

stop() {
    ebegin "Stopping ${SVCNAME}"
    start-stop-daemon --stop --signal USR1 --pidfile ${PIDFILE}
    eend $?
}