aports/main/ez-ipupdate/ez-ipupdate.initd

53 lines
1.2 KiB
Bash

#!/sbin/openrc-run
# init.d file for ez-ipupdate
NAME=ez-ipupdate
DAEMON=/usr/bin/$NAME
DAEMON_GROUP=ipupdate
DAEMON_USER=ipupdate
# now convert it into command line options
OPTS="-d -S ${SERVICE} -h ${HOST} -u \"${USER}:${PASS}\" -i ${IFACE}"
if [ "$WILDCARD" == 1 ]; then
OPTS="${OPTS} -w"
fi
if [ "$SERVER" != "" ]; then
OPTS="${OPTS} -s \"${SERVER}\""
fi
OPTS="${OPTS} -t ${TIMEOUT} -M ${MAX_INTERVAL}"
depend() {
need net
after firewall
}
start() {
checkpath --directory /var/run/$NAME --owner $DAEMON_USER
ebegin "Starting ${NAME}"
start-stop-daemon --start --quiet \
--pidfile /var/run/${NAME}/${NAME}.pid \
--user ${DAEMON_USER}:${DAEMON_GROUP} \
--exec ${DAEMON} -- ${OPTS}
eend $?
}
stop() {
ebegin "Stopping ${NAME}"
start-stop-daemon --stop --quiet \
--pidfile /var/run/${NAME}/${NAME}.pid \
--exec ${DAEMON}
eend $?
}
reload() {
ebegin "Reloading ${NAME}"
if ! service_started "${NAME}" ; then
eend 1 "${NAME} is not started"
return 1
fi
start-stop-daemon --stop --oknodo --signal HUP \
--exec ${DAEMON} --pidfile /var/run/${NAME}.pid
eend $?
}