Blob Blame History Raw
#!/bin/sh
#
# ddclient      This shell script takes care of starting and stopping ddclient.
#
# chkconfig:    - 65 35
# description:  ddclient provides support for updating dynamic DNS services
# processname:  ddclient
# config:       /etc/sysconfig/ddclient

# Source function library.
. /etc/rc.d/init.d/functions

# Source networking configuration.
. /etc/sysconfig/network

# Check that networking is up.
[ "$NETWORKING" = "no" ] && exit 0

. /etc/sysconfig/ddclient

exec="/usr/sbin/ddclient"
prog=$(basename $exec)
lockfile=/var/lock/subsys/$prog

start() {
    echo -n $"Starting $prog: "
    daemon $exec $DDCLIENT_OPTIONS
    retval=$?
    echo
    [ $retval -eq 0 ] && touch $lockfile
    return $retval
}

stop() {
    echo -n $"Stopping $prog: "
    killproc $prog
    retval=$?
    echo
    [ $retval -eq 0 ] && rm -f $lockfile
    return $retval
}

restart() {
    stop
    start
}

reload() {
    restart
}

force_reload() {
    restart
}

fdrstatus() {
    status $prog
}

# See how we were called.
case "$1" in
    start|stop|restart|reload)
        $1
        ;;
    force-reload)
        force_reload
        ;;
    status)
        fdrstatus
        ;;
    condrestart)
        [ ! -f $lockfile ] || restart
        ;;
    *)
        echo $"Usage: $0 {start|stop|status|restart|condrestart|reload|force-reload}"
        exit 2
esac