#!/bin/sh # # ddclient ddclient (secure shell daemon) # # chkconfig: 345 55 45 # # description: ddclient - dynamic dns client # Source function library . /etc/rc.d/init.d/functions # Get network config . /etc/sysconfig/network # Get service config [ -f /etc/sysconfig/ddclient ] && . /etc/sysconfig/ddclient # Check that networking is up. if is_yes "${NETWORKING}"; then if [ ! -f /var/lock/subsys/network -a "$1" != stop -a "$1" != status ]; then msg_network_down "Dynamic DNS Client" exit 1 fi else exit 0 fi start() { # Check if the service is already running? if [ ! -f /var/lock/subsys/ddclient ]; then msg_starting "Dynamic DNS Client" daemon /usr/sbin/ddclient -daemon 300 RETVAL=$? [ $RETVAL -eq 0 ] && touch /var/lock/subsys/ddclient else msg_already_running "Dynamic DNS Client" fi } stop() { if [ -f /var/lock/subsys/ddclient ]; then msg_stopping "Dynamic DNS Client" killproc ddclient rm -f /var/run/ddclient.pid /var/lock/subsys/ddclient >/dev/null 2>&1 else msg_not_running "Dynamic DNS Client" fi } RETVAL=0 # See how we were called. case "$1" in start) start ;; stop) stop ;; restart) stop start ;; status) status ddclient exit $? ;; reload|force-reload) if [ -f /var/lock/subsys/ddclient ]; then msg_reloading "Dynamic DNS Client" killproc ddclient -HUP RETVAL=$? else msg_not_running "Dynamic DNS Client" exit 7 fi ;; *) msg_usage "$0 {start|stop|restart|reload|force-reload|status}" exit 3 esac exit $RETVAL