ez-ipupdate.initd 1.12 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
#!/sbin/runscript

# 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
22
	after firewall
23 24 25 26 27
}

start() {
        ebegin "Starting ${NAME}"
                start-stop-daemon --start --quiet \
28
                        --pidfile /var/run/${NAME}/${NAME}.pid \
29
                        --user ${DAEMON_USER}:${DAEMON_GROUP} \
30 31 32 33 34 35 36
                        --exec ${DAEMON} -- ${OPTS}
        eend $?
}

stop() {
	ebegin "Stopping ${NAME}"
		start-stop-daemon --stop --quiet \
37 38
			--pidfile /var/run/${NAME}/${NAME}.pid \
			--exec ${DAEMON}
39 40 41 42 43 44 45 46 47 48 49 50 51 52
	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 $?
}