Skip to content

Instantly share code, notes, and snippets.

@dsh0005
Last active June 27, 2020 16:24
Show Gist options
  • Save dsh0005/bb3b2284df7b2c85436243e7df705dde to your computer and use it in GitHub Desktop.
Save dsh0005/bb3b2284df7b2c85436243e7df705dde to your computer and use it in GitHub Desktop.
ddns-route53 OpenRC init script
#!/sbin/openrc-run
command="/usr/local/bin/ddns-route53"
description="Route53 Dynamic DNS daemon"
cfgfile="/etc/ddns-route53/ddns-route53.yml"
schedule='\*/15\ \*\ \*\ \*\ \*'
command_args="--config \"${cfgfile}\" --schedule ${schedule}"
command_user="ddnsr53u:ddnsr53"
command_background=true
pidfile="/run/${RC_SVCNAME}.pid"
depend() {
need net
provide ddns
}
checkconfig() {
# basic sanity check only
if [ ! -f "${cfgfile}" ] ; then
eerror "Please create ddns-route53.yml"
return 1
fi
return 0
}
start_pre() {
if [ "${RC_CMD}" != "restart" ] ; then
checkconfig || return $?
fi
}
stop_pre() {
if [ "${RC_CMD}" = "restart" ] ; then
checkconfig || return $?
fi
}
@dsh0005
Copy link
Author

dsh0005 commented Jun 27, 2020

Lines 6-7 do the right thing, but for all the really wrong reasons.
Trace:

+ eval start-stop-daemon --start --exec /usr/local/bin/ddns-route53 --pidfile /run/ddns-route53.pid --user ddnsr53u:ddnsr53 --background --make-pidfile -- --config '"/etc/ddns-route53/ddns-route53.yml"' --schedule '\*/15\' '\*\' '\*\' '\*\' '\*'
+ start-stop-daemon --start --exec /usr/local/bin/ddns-route53 --pidfile /run/ddns-route53.pid --user ddnsr53u:ddnsr53 --background --make-pidfile -- --config /etc/ddns-route53/ddns-route53.yml --schedule '*/15 * * * *'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment