#!/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 DDCLIENT_OPTIONS="-daemon 300" [ -f /etc/sysconfig/ddclient ] && . /etc/sysconfig/ddclient pidfile=/var/run/ddclient/ddclient.pid # 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_already_running "Dynamic DNS Client" return fi msg_starting "Dynamic DNS Client" daemon --user ddclient /usr/sbin/ddclient -pid $pidfile $DDCLIENT_OPTIONS RETVAL=$? [ $RETVAL -eq 0 ] && touch /var/lock/subsys/ddclient } stop() { if [ ! -f /var/lock/subsys/ddclient ]; then msg_not_running "Dynamic DNS Client" return fi msg_stopping "Dynamic DNS Client" killproc --pidfile $pidfile ddclient rm -f $pidfile /var/lock/subsys/ddclient >/dev/null 2>&1 } condrestart() { if [ ! -f /var/lock/subsys/ddclient ]; then msg_not_running "Dynamic DNS Client" return 0 fi stop start } reload() { if [ ! -f /var/lock/subsys/ddclient ]; then msg_not_running "Dynamic DNS Client" RETVAL=7 return fi msg_reloading "Dynamic DNS Client" killproc ddclient -HUP RETVAL=$? } RETVAL=0 # See how we were called. case "$1" in start) start ;; stop) stop ;; restart) stop start ;; try-restart) condrestart ;; reload|force-reload) reload ;; status) status --pidfile $pidfile ddclient exit $? ;; *) msg_usage "$0 {start|stop|restart|try-restart|reload|force-reload|status}" exit 3 esac exit $RETVAL