From: Bjoern Sikora Date: Tue, 4 Aug 2009 14:59:44 +0000 (+0200) Subject: Init script taken from trusted_net_helper and adjusted to bpdyndnsd needs. X-Git-Tag: v1.1~253 X-Git-Url: http://developer.intra2net.com/git/?a=commitdiff_plain;h=dc50e618fe2a8ef9bf151c940824e75fe13ca3f8;p=bpdyndnsd Init script taken from trusted_net_helper and adjusted to bpdyndnsd needs. --- diff --git a/scripts/bpdyndnsd b/scripts/bpdyndnsd new file mode 100755 index 0000000..77bf508 --- /dev/null +++ b/scripts/bpdyndnsd @@ -0,0 +1,101 @@ +#! /bin/sh +# +# bpdyndnsd +# +# chkconfig: - 93 04 +# description: Bullet proof dynamic DNS update daemon. +# processname: bpdyndnsd + +# Source function library. +. /etc/rc.d/init.d/functions + +# define the paths to the binaries: +path_prg=/usr/intranator/bin/bpdyndnsd + +# other paths: +path_pidfile=/var/run/bpdyndnsd.pid + + +## +## tool functions: +## + +is_running() { + [ -f ${path_pidfile} ] || return 1 + pid_from_file=`head -n1 ${path_pidfile}` + [ -L /proc/${pid_from_file}/exe ] || return 1 + [ "`readlink /proc/${pid_from_file}/exe`" = "${path_prg}" ] +} +# eo is_running + + +## +## the functions: +## + +start() { + echo -n "Starting bpdyndnsd: " + + ${path_prg} --daemon_mode 1 + RETVAL=$? + echo + + if [ $RETVAL -eq 0 ] ; then + touch /var/lock/subsys/bpdyndnsd + fi + return $RETVAL +} + +stop() { + echo -n "Stopping bpdyndnsd: " + + killproc bpdyndnsd + RETVAL=$? + echo + + rm -f /var/lock/subsys/bpdyndnsd + return $RETVAL +} + +reload() { + echo -n "Reloading bpdyndnsd: " + + killproc bpdyndnsd -HUP + RETVAL=$? + echo + + return $RETVAL +} + +## +## determine what we should do: +## +case "$1" in + start) + start + ;; + stop) + stop + ;; + status) + status bpdyndnsd + ;; + restart) + stop + start + ;; + reload) + reload + ;; + condrestart) + if [ -f /var/lock/subsys/bpdyndnsd ]; then + stop + start + fi + ;; + *) + echo "Usage: bpdyndnsd {start|stop|status|restart|reload|condrestart}" + exit 1 +esac + +exit $RETVAL