ddclient/sample-etc_rc.d_init.d_ddclient.alpine
Steve8291 6b7800380c Adjust path to ddclient
Installing with `make install` automatically places the ddclient
executable in `/usr/bin/ddclient`. This service file has the wrong
path and that causes systemd to be unable to start ddclient.
2020-07-10 12:04:21 -04:00

38 lines
795 B
Text
Executable file

#!/sbin/openrc-run
description="ddclient Daemon for Alpine"
command="/usr/bin/ddclient"
config_file="/etc/ddclient/ddclient.conf"
command_args=""
pidfile=$(grep -v '^\s*#' "${config_file}" | grep -i -m 1 pid= | awk -F '=' '{print $2}')
delay=$(grep -v '^\s*#' "${config_file}" | grep -i -m 1 "daemon" | awk -F '=' '{print $2}')
if [ -z "${delay}" ]
then
command_args="-daemon 300"
else
command_args=""
fi
depend() {
use logger
need net
after firewall
}
start() {
ebegin "Starting ddclient"
start-stop-daemon --start \
--exec "${command}" \
--pidfile "${pidfile}" \
-- \
${command_args}
eend $?
}
stop() {
ebegin "Stopping ddclient"
start-stop-daemon --stop --exec "${command}" \
--pidfile "${pidfile}"
eend $?
}