Sophie

Sophie

distrib > Mandriva > current > i586 > media > contrib-release-src > by-pkgid > 39e51dbca690b5de772070af30e33b9f > files > 4

noip-2.1.9-2mdv2010.0.src.rpm

#!/bin/sh
#
# noip         This script start noip deamon
#
# chkconfig: 345 26 59
# description: This script start and stop the noip deamon
# processname: noip
# pid /var/run/noip.pid
# config: /etc/noip.conf

### BEGIN INIT INFO
# Provides: noip
# Required-Start: $network
# Required-Stop:  $network
# Default-Start: 3 4 5
# Short-Description: The noip daemon
# Description: The noip daemon update the noip DNS entry
### END INIT INFO

. /etc/init.d/functions

processname=noip
servicename=noip

# Sanity checks.
[ -x /usr/sbin/noip ] || exit 0

RETVAL=0

function noip_start() {
        gprintf "Starting noip daemon: "
        daemon --check $servicename $processname
        RETVAL=$?
        echo
        [ $RETVAL -eq 0 ] && touch /var/lock/subsys/$servicename && echo `/sbin/pidof $processname` > /var/run/noip.pid
}

function noip_stop() {
        gprintf "Stopping noip daemon: "

        killproc $servicename -TERM
        RETVAL=$?
        echo
        if [ $RETVAL -eq 0 ]; then
                rm -f /var/lock/subsys/$servicename
                rm -f /var/run/noip.pid
        fi
}

function noip_status() {
        status $processname
        RETVAL=$?
}

case "$1" in
    start)
        noip_start
        ;;
    stop)
        noip_stop
        ;;
    restart|reload)
        noip_stop
        sleep 1
        noip_start
        ;;
    condrestart)
        if [ -f /var/lock/subsys/$servicename ]; then
            noip_stop
            sleep 1
            noip_start
        fi
        ;;
    status)
        noip_status
        ;;
    *)
        gprintf "Usage: %s:\n" "$(basename $0) {start|stop|restart|status|condrestart}"
        exit 1
        ;;
esac

exit 0