#!/bin/sh # # ez-ipupdate Starts and stops the ez-ipupdate daemon # # chkconfig: - 55 45 # # processname: ez-ipupdate # description: Check and update your IP to dynamic DNS Server. # pidfile: /var/run/ez-ipupdate/ez-ipudpate.pid # config: /etc/ez-ipupdate.conf EZ_CONFIG=/etc/ez-ipupdate.conf EZ_BIN=/usr/sbin/ez-ipupdate EZ_PID=/var/run/ez-ipupdate/ez-ipupdate.pid PROG=ez-ipupdate LOCKFILE="/var/lock/subsys/$PROG" # Make sure relevant files exist [ -x "$EZ_BIN" -a -s "$EZ_CONFIG" ] || exit 0 # Source function library. . /etc/rc.d/init.d/functions # Source networking configuration. . /etc/sysconfig/network # Check that networking is up. [ "$NETWORKING" = "no" ] && exit 0 RETVAL=0 start() { # Start daemons. start_daemon --pidfile "$EZ_PID" --lockfile "$LOCKFILE" -- "$EZ_BIN" --daemon --config-file "$EZ_CONFIG" --pid-file "$EZ_PID" RETVAL=$? return $RETVAL } stop() { # Stop daemons. stop_daemon --pidfile "$EZ_PID" --lockfile "$LOCKFILE" -- "$PROG" RETVAL=$? return $RETVAL } reload() { # Reload config by sending a SIGHUP. msg_reloading "$PROG" stop_daemon --pidfile "$EZ_PID" -HUP -- "$PROG" RETVAL=$? echo } restart() { stop start RETVAL=$? } # See how we were called. case "$1" in start) start ;; stop) stop ;; restart) restart ;; reload) reload ;; condstop) if [ -e "$LOCKFILE" ]; then stop fi ;; condrestart) if [ -e "$LOCKFILE" ]; then restart fi ;; condreload) if [ -e "$LOCKFILE" ]; then reload fi ;; status) status --pidfile $EZ_PID $PROG RETVAL=$? if [ -r $EZ_CONFIG ]; then ez_cache=`grep -E '^[[:space:]]*cache-file' $EZ_CONFIG | cut -d "=" -f2` [ -n "$ez_cache" ] && \ echo "Last IP update: "`cat $ez_cache | cut -d "," -f2` fi ;; *) msg_usage "${0##*/} {start|stop|reload|restart|condstop|condrestart|condreload|status}" RETVAL=1 esac exit $RETVAL