#!/sbin/openrc-run # Copyright 1999-2014 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 HOST="${RC_SVCNAME##*.}" PIDFILE=/run/ddclient/${HOST}.pid if [ "${HOST}" = "ddclient" ] ; then PIDFILE="/run/ddclient/ddclient.pid" CONFIGFILE="/etc/ddclient/ddclient.conf" CACHEFILE="/var/cache/ddclient/ddclient.cache" fi CONFIGFILE="/etc/ddclient/${HOST}.conf" CACHEFILE="/var/cache/ddclient/${HOST}.cache" depend() { before cron need net use dns logger squid } checkconfig() { checkpath -f -m 0600 -o ddclient:ddclient ${CONFIGFILE} || 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 ${RC_SVCNAME}" start-stop-daemon --start \ --user ddclient \ --name ddclient \ --pidfile ${PIDFILE} \ --exec /usr/sbin/ddclient -- -pid=${PIDFILE} -file ${CONFIGFILE} -cache ${CACHEFILE} eend $? } stop() { ebegin "Stopping ${RC_SVCNAME}" start-stop-daemon --stop --signal USR1 --pidfile ${PIDFILE} eend $? }