File noip2.init of Package noip2

#!/bin/sh
#
# description: Starts and stops the no-ip.com Dynamic dns client daemon
#
### BEGIN INIT INFO
# Provides: noip2
# Required-Start: $network $syslog $remote_fs
# Required-Stop: $network
# Default-Start: 2 3 5
# Default-Stop: 0 1 6
# Short-Description: NoIP2 daemon
# Description: Start or stop the NoIP2 daemon
### END INIT INFO

NOIP2_BIN=/usr/bin/noip2
test -x $NOIP2_BIN || { echo "$NOIP2_BIN not installed";
        if [ "$1" = "stop" ]; then exit 0;
        else exit 5; fi; }

CONFIG=/etc/no-ip2.conf
test -f $CONFIG || { echo "no configuration found";
        if [ "$1" = "stop" ]; then exit 0;
	else exit 5; fi; }

# Source function library.
. /etc/rc.status
rc_reset

# Avoid using root's TMPDIR
unset TMPDIR

RETVAL=0

case "$1" in
  start)
        echo -n "Starting no-ip client daemon "
        /sbin/startproc $NOIP2_BIN -M -c $CONFIG
	rc_status -v
        ;;
  stop)
	echo -n "Shutting down no-ip client daemon "
	/sbin/killproc $NOIP2_BIN
	rc_status -v
        ;;
  try-restart|condrestart)
        ## Do a restart only if the service was active before.
        ## Note: try-restart is now part of LSB (as of 1.9).
        ## RH has a similar command named condrestart.
        if test "$1" = "condrestart"; then
                echo "${attn} Use try-restart ${done}(LSB)${attn} rather than condrestart ${warn}(RH)${norm}"
        fi
        $0 status
        if test $? = 0; then
                $0 restart
        else
                rc_reset        # Not running is not a failure.
        fi
        # Remember status and be quiet
        rc_status
        ;;

  restart)
        $0 stop
	$0 start
	rc_status
        ;;
  force-reload)
	$0 try-restart
	rc_status
	;;
  reload)
	rc_failed 3
	rc_status -v
	;;
  status)
	echo -n "Checking for no-ip service "
	/sbin/checkproc $NOIP2_BIN
	rc_status -v
	;;
  *)
        echo $"Usage: $0 {start|stop|status|try-restart|restart|force-reload|reload}"
        exit 1
esac
rc_exit
openSUSE Build Service is sponsored by