#! /bin/sh

. /etc/init.d/functions.sh
. /etc/conf.d/axisns

if [ -e /var/run/init.d/net.active_interface ]; then
	_active_interface=`cat /var/run/init.d/net.active_interface`
	if [ -n $_active_interface ]; then
		INTERFACE_OPT="-i $_active_interface"
	fi
fi

case "$1" in
	start)
		begin "Starting Axis Internet Dynamic DNS Service"
		/bin/axisns $INTERFACE_OPT $AXISNS_OPTIONS && respawn_on /bin/axisns $INTERFACE_OPT $AXISNS_OPTIONS
		end $?
		;;
	stop)
		begin "Stopping Axis Internet Dynamic DNS Service"
		stop_daemon /bin/axisns
		end $?
		;;
	*)
		error "Usage: $0 start|stop"
		;;
esac
