Preparing the release of v3.9.0
[ddclient.git] / sample-etc_rc.d_init.d_ddclient.alpine
blobbdfffdbf0276d13573af50a83563f40f31c6a1bf
1 #!/sbin/openrc-run
2 description="ddclient Daemon for Alpine"
3 command="/usr/sbin/ddclient"
4 config_file="/etc/ddclient/ddclient.conf"
5 command_args=""
6 pidfile=$(grep -v '^\s*#' "${config_file}" | grep -i -m 1 pid= | awk -F '=' '{print $2}')
7 delay=$(grep -v '^\s*#' "${config_file}" | grep -i -m 1 "daemon" | awk -F '=' '{print $2}')
9 if [ -z "${delay}" ]
10 then
11         command_args="-daemon 300"
12 else
13         command_args=""
17 depend() {
18     use logger
19     need net
20     after firewall
23 start() {
24     ebegin "Starting ddclient"
25     start-stop-daemon --start \
26         --exec "${command}" \
27         --pidfile "${pidfile}" \
28         -- \
29         ${command_args}
30     eend $?
33 stop() {
34     ebegin "Stopping ddclient"
35     start-stop-daemon --stop --exec "${command}" \
36         --pidfile "${pidfile}"
37     eend $?