diff -ru nsd.old/files/nsd.in nsd/files/nsd.in --- nsd.old/files/nsd.in 2010-11-17 14:16:38.485927069 +0100 +++ nsd/files/nsd.in 2010-11-17 14:48:26.393097953 +0100 @@ -17,24 +17,51 @@ required_files=%%PREFIX%%/etc/nsd/nsd.conf -command=%%PREFIX%%/sbin/${name} +command=%%PREFIX%%/sbin/nsdc pidfile=`%%PREFIX%%/sbin/nsd-checkconf -o pidfile %%PREFIX%%/etc/nsd/nsd.conf` load_rc_config ${name} nsd_enable=${nsd_enable-"NO"} +extra_commands="reload" +start_precmd="nsd_precmd" +status_cmd="nsd_status" +start_cmd="nsd_start" +reload_cmd="nsd_reload" stop_cmd="nsd_stop" +nsd_precmd() +{ + db=`%%PREFIX%%/sbin/nsd-checkconf -o database %%PREFIX%%/etc/nsd/nsd.conf` + if [ ! -f "$db" ]; then + ${command} rebuild + fi +} + +nsd_status() +{ + ${command} running && echo "nsd running pid `head -n 1 ${pidfile}`" +} + +nsd_start() +{ + echo "Starting nsd." + ${command} start +} + +nsd_reload() +{ + ${command} rebuild && ${command} reload +} + nsd_stop() { echo "Merging nsd zone transfer changes to zone files." - %%PREFIX%%/sbin/nsdc patch - - sleep 5 + ${command} patch echo "Stopping nsd." - %%PREFIX%%/sbin/nsdc stop + ${command} stop } run_rc_command "$1"