Novell Home

Updating DynDNS.org Automatically

Novell Cool Solutions: Tip
By Chris Lander

Digg This - Slashdot This

Posted: 8 Mar 2007
 

Problem:

Updating DynDNS.org automatically.

Solution:

Install the ddclient package from the package group:

Productivity/Networking/DNS/Utilities

Edit /etc/ddclient.conf to suit your needs.

Create a suitable start/stop script in /etc/init.d. (see the example)

Activate the service in the Yast -> System -> System Services. (Runlevel)

Example:

#! /bin/sh
# Copyright (c) 2002-2004 SuSE Linux AG, Nuernberg, Germany.
# All rights reserved.
#
# Author: Chris Lander <clander@labbs.com>
#         (adapted from existing scripts in /etc/init.d and those supplied with the package ddclient)
#
# /etc/init.d/ddclient
#   and its symbolic link
# /usr/sbin/rcddclient
#
### BEGIN INIT INFO
# Provides:       ddclient
# Required-Start: $network syslog
# Required-Stop:
# Default-Start:  3 5
# Default-Stop:   0 1 2 6
# Description:    Dynamic DNS service update deamon
### END INIT INFO

DDCLIENT_BIN="/usr/sbin/ddclient"
DDCLIENT_CMD="ddclient"
DDCLIENT_CONF="/etc/ddclient.conf"
PID_FILE="/var/run/ddclient.pid"

. /etc/rc.status
rc_reset

# Check for missing binary
if [ ! -x ${DDCLIENT_BIN} ]; then
echo -n >&2 "ddclient daemon, ${DDCLIENT_BIN} is not installed. "
rc_status -s
exit 5
fi

case "$1" in
start)
echo -n "Starting ddclient daemon "
if [ ! -f ${DDCLIENT_CONF} ]; then
echo -n >&2 "ddclient configuration file, ${DDCLIENT_CONF} does not exist. "
rc_status -s
exit 6
fi
checkproc -p ${PID_FILE} ${DDCLIENT_CMD}
case $? in
0) echo -n "- Warning: daemon already running. " ;rc_failed;rc_status -v;exit;;
esac
${DDCLIENT_CMD} -daemon 300 -file ${DDCLIENT_CONF}
rc_status -v
;;
stop)
echo -n "Shutting down ddclient daemon "
checkproc -p ${PID_FILE} ${DDCLIENT_CMD}
if [[ $? -eq 0 ]]; then
    killproc -p ${PID_FILE} -t 10 ${DDCLIENT_CMD}
else
    echo -n " Warning: daemon not running. "
    rc_failed
fi
rc_status -v
;;
try-restart|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
fi
rc_status
;;
restart)
$0 stop
$0 start
rc_status
;;
status)
echo -n "Checking for ddclient daemon "
checkproc -p ${PID_FILE} ${DDCLIENT_CMD}
rc_status -v
;;
*)
echo "Usage: $0 {start|stop|status|try-restart|restart|}"
exit 1
;;
esac
rc_exit

Environment:

This script was created and tested on Suse 10.0-OSS, using ddclient 3.6.6-2


Novell Cool Solutions (corporate web communities) are produced by WebWise Solutions. www.webwiseone.com

© 2014 Novell