diff -uNr pdns-2.9.21.2-origin/pdns/pdns.in pdns-2.9.21.2/pdns/pdns.in --- pdns-2.9.21.2-origin/pdns/pdns.in 2009-03-04 18:36:58 +0300 +++ pdns-2.9.21.2/pdns/pdns.in 2009-03-04 18:38:03 +0300 @@ -48,77 +48,109 @@ ret=$($BINARYPATH/pdns_control $EXTRAOPTS $1 $2 2> /dev/null) } - doPC ping NOTRUNNING=$? +SERVICE="PowerDNS" + case "$1" in status) - if test "$NOTRUNNING" = "0" - then + if test "$NOTRUNNING" = "0" + then doPC status echo $ret else - echo "not running" + msg_not_running $SERVICE + passed + printf "\n" fi - ;; + ;; stop) - echo -n "Stopping PowerDNS authoritative nameserver: " - if test "$NOTRUNNING" = "0" - then + msg_stopping $SERVICE + if test "$NOTRUNNING" = "0" + then doPC quit + if test "$?" = "0" + then + success + else + failture + fi + printf "\n" echo $ret else - echo "not running" - fi - ;; + msg_not_running $SERVICE + passed + printf "\n" + fi + ;; force-stop) - echo -n "Stopping PowerDNS authoritative nameserver: " killall -v -9 pdns_server - echo "killed" + if test "$?" = "0" + then + msg_stopping $SERVICE + success + else + msg_stopping $SERVICE + failure + fi + printf "\n" ;; start) - echo -n "Starting PowerDNS authoritative nameserver: " - if test "$NOTRUNNING" = "0" - then - echo "already running" + msg_starting $SERVICE + if test "$NOTRUNNING" = "0" + then + msg_already_running $SERVICE + passed else $pdns_server --daemon --guardian=yes if test "$?" = "0" then - echo "started" + success + else + failure fi - fi - ;; + fi + printf "\n" + ;; force-reload | restart) - echo -n "Restarting PowerDNS authoritative nameserver: " - echo -n stopping and waiting.. + echo -n "Restarting PowerDNS service: " + echo -n stopping and waiting... doPC quit sleep 3 - echo done + success + printf "\n" $0 start ;; - reload) - echo -n "Reloading PowerDNS authoritative nameserver: " - if test "$NOTRUNNING" = "0" - then + reload) + msg_reloading $SERVICE + if test "$NOTRUNNING" = "0" + then doPC cycle - echo requested reload + if test "$?" = "0" + then + success + else + failure + fi + printf "\n" else - echo not running yet + msg_not_running $SERVICE + passed + printf "\n" $0 start - fi - ;; + fi + ;; condstop) test "$NOTRUNNING" = "0" && $0 stop ;; - + condrestart) test "$NOTRUNNING" = "0" && $0 restart ;; @@ -126,47 +158,61 @@ test "$NOTRUNNING" = "0" && $0 reload ;; monitor) - if test "$NOTRUNNING" = "0" - then - echo "already running" + if test "$NOTRUNNING" = "0" + then + msg_already_running $SERVICE + passed else $pdns_server --daemon=no --guardian=no --control-console --loglevel=9 - fi - ;; + if test "$?" = "0" + then + success + else + failure + fi + fi + printf "\n" + ;; dump) - if test "$NOTRUNNING" = "0" - then + if test "$NOTRUNNING" = "0" + then doPC list echo $ret else - echo "not running" - fi - ;; + msg_not_running $SERVICE + passed + printf "\n" + fi + ;; show) if [ $# -lt 2 ] then - echo Insufficient parameters + echo -n "Insufficient parameters" + passed + printf "\n" exit - fi - if test "$NOTRUNNING" = "0" - then + fi + if test "$NOTRUNNING" = "0" + then echo -n "$2=" doPC show $2 ; echo $ret else - echo "not running" - fi - ;; + msg_not_running $SERVICE + passed + printf "\n" + fi + ;; mrtg) if [ $# -lt 2 ] then echo Insufficient parameters exit - fi - if test "$NOTRUNNING" = "0" - then + fi + if test "$NOTRUNNING" = "0" + then doPC show $2 ; echo $ret if [ "$3x" != "x" ] then @@ -177,25 +223,27 @@ doPC uptime ; echo $ret echo PowerDNS daemon else - echo "not running" - fi - - ;; + msg_not_running $SERVICE + passed + printf "\n" + fi + ;; cricket) if [ $# -lt 2 ] then echo Insufficient parameters exit - fi - if test "$NOTRUNNING" = "0" - then + fi + if test "$NOTRUNNING" = "0" + then doPC show $2 ; echo $ret else - echo "not running" - fi - - ;; + msg_not_running $SERVICE + passed + printf "\n" + fi + ;;