diff --git a/README.md b/README.md index a83a1e1..f492f5f 100644 --- a/README.md +++ b/README.md @@ -72,6 +72,15 @@ INSTALLATION: apk add perl ## start the first time by hand rc-service ddclient start + + ## For those using Ubuntu style rc files and using daemon-mode: + cp sample-etc_rc.d_init.d_ddclient.ubuntu /etc/init.d/ddclient + ## enable automatic startup when booting + update-rc.d ddclient defaults + ## make sure you have perl installed + apt-get install perl + ## start the first time by hand + service ddclient start ## If you are not using daemon-mode, configure cron and dhcp or ppp ## as described below. diff --git a/sample-etc_rc.d_init.d_ddclient.ubuntu b/sample-etc_rc.d_init.d_ddclient.ubuntu index 348ffd4..b2d6878 100755 --- a/sample-etc_rc.d_init.d_ddclient.ubuntu +++ b/sample-etc_rc.d_init.d_ddclient.ubuntu @@ -20,15 +20,19 @@ test -f $CONF || exit 0 case "$1" in start) - log_begin_msg "Starting ddclient..." - DELAY=`grep -v '^\s*#' $CONF | grep -i -m 1 "daemon" | awk -F '=' '{print $2}'` - if [ -z "$DELAY" ] ; then - DELAY="-daemon 300" + if [ ! -f $PIDFILE ]; then + log_begin_msg "Starting ddclient..." + DELAY=`grep -v '^\s*#' $CONF | grep -i -m 1 "daemon" | awk -F '=' '{print $2}'` + if [ -z "$DELAY" ] ; then + DELAY="-daemon 300" + else + DELAY='' + fi + start-stop-daemon -S -q -p $PIDFILE -x $DDCLIENT -- $DELAY + log_end_msg $? else - DELAY='' + log_warning_msg "Service ddclient already running..." fi - start-stop-daemon -S -q -p $PIDFILE -x $DDCLIENT -- $DELAY - log_end_msg $? ;; stop) if [ -f $PIDFILE ] ; then @@ -36,6 +40,8 @@ case "$1" in start-stop-daemon -K -q -p $PIDFILE log_end_msg $? rm -f $PIDFILE + else + log_warning_msg "No ddclient running..." fi ;; restart|reload|force-reload)