From dc50e618fe2a8ef9bf151c940824e75fe13ca3f8 Mon Sep 17 00:00:00 2001 From: Bjoern Sikora Date: Tue, 4 Aug 2009 16:59:44 +0200 Subject: [PATCH] Init script taken from trusted_net_helper and adjusted to bpdyndnsd needs. --- scripts/bpdyndnsd | 101 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 101 insertions(+), 0 deletions(-) create mode 100755 scripts/bpdyndnsd 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 -- 1.7.1