#!/bin/sh

. /etc/init.d/init-functions

case "$1" in
	start)
		notify "Starting dnsd "
#		sleep 10
		/usr/bin/dnsd -d -c /etc/dnsd.conf
		echo "nameserver 0.0.0.0" > /etc/resolv.conf
		check $?
		;;
	stop)
		notify "Stopping dnsd "
		kill $(cat /var/run/dnsd.pid) &> /dev/null 
		rm /var/run/dnsd.pid
		check $?
		;;
	restart|reload)
		"$0" stop
		"$0" start
		;;
	*)
		echo "dnsmasq init script usage: $0 {start|stop|restart}"
		return 1
esac
return $?
