[Pkg-pdns-maintainers] Bug#708861: pdns-server: init script exit codes not LSB-compliant
Marc Haber
mh+debian-packages at zugschlus.de
Wed Oct 2 16:48:41 UTC 2013
tags #708861 confirmed patch pending
thanks
On Sun, May 19, 2013 at 11:51:04AM +0200, Marc Haber wrote:
> Please give an example. Care was taken to have the init script exit
> codes LSB compliant. This must be a misunderstanding.
I apologize for the utter nonsense I have written in May. Of course
our exit codes are wrong.
This is the proposed patch from git. Please review and comment.
Greetings
Marc
diff --git a/debian/pdns-server.pdns.init b/debian/pdns-server.pdns.init
index 5ecc0e7..53ed9de 100644
--- a/debian/pdns-server.pdns.init
+++ b/debian/pdns-server.pdns.init
@@ -104,32 +104,51 @@ case "$1" in
[ "$VERBOSE" != no ] && log_daemon_msg "Starting $DESC" "$NAME"
do_start
case "$?" in
- 0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;;
- 2) [ "$VERBOSE" != no ] && log_end_msg 1 ;;
+ 0|1)
+ [ "$VERBOSE" != no ] && log_end_msg 0
+ exit 0
+ ;;
+ 2)
+ [ "$VERBOSE" != no ] && log_end_msg 1
+ exit 1
+ ;;
esac
;;
stop)
[ "$VERBOSE" != no ] && log_daemon_msg "Stopping $DESC" "$NAME"
do_stop
case "$?" in
- 0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;;
- 2) [ "$VERBOSE" != no ] && log_end_msg 1 ;;
+ 0|1)
+ [ "$VERBOSE" != no ] && log_end_msg
+ exit 0
+ ;;
+ 2)
+ [ "$VERBOSE" != no ] && log_end_msg 1
+ exit 1
+ ;;
esac
;;
status)
if isrunning; then
log_success_msg "$NAME is running: $(doPC status)"
+ exit 0
else
log_failure_msg "$NAME is not running"
- exit 1
+ exit 3
fi
;;
force-stop)
[ "$VERBOSE" != no ] && log_daemon_msg "Killing $ODESC (all instances)"
kill -9 $(pidof pdns_server)
case "$?" in
- 0) [ "$VERBOSE" != no ] && log_end_msg 0 ;;
- 1) [ "$VERBOSE" != no ] && log_end_msg 1 ;;
+ 0)
+ [ "$VERBOSE" != no ] && log_end_msg 0
+ exit 0
+ ;;
+ 1)
+ [ "$VERBOSE" != no ] && log_end_msg 1
+ exit 1
+ ;;
esac
;;
restart)
@@ -139,14 +158,24 @@ case "$1" in
0|1)
do_start
case "$?" in
- 0) log_end_msg 0 ;;
- 1) log_end_msg 1 ;; # Old process is still running
- *) log_end_msg 1 ;; # Failed to start
+ 0)
+ log_end_msg 0
+ exit 0
+ ;;
+ 1)
+ log_end_msg 1 # Old process is still running
+ exit 1
+ ;;
+ *)
+ log_end_msg 1 # Failed to start
+ exit 1
+ ;;
esac
;;
*)
# Failed to stop
log_end_msg 1
+ exit 1
;;
esac
;;
@@ -155,44 +184,57 @@ case "$1" in
if isrunning; then
doPC cycle >/dev/null
case "$?" in
- 0) [ "$VERBOSE" != no ] && log_end_msg 0 ;;
- 1) [ "$VERBOSE" != no ] && log_end_msg 1 ;;
+ 0)
+ [ "$VERBOSE" != no ] && log_end_msg 0
+ exit 0
+ ;;
+ 1)
+ [ "$VERBOSE" != no ] && log_end_msg 1
+ exit 1
+ ;;
esac
else
log_end_msg 0
+ exit 7
fi
;;
monitor)
if isrunning; then
echo "already running"
+ exit 1
else
pdns_server $DAEMON_ARGS --daemon=no --guardian=no --control-con
+ exit 0
fi
;;
dump)
if isrunning; then
doPC list
+ exit 0
else
echo "not running"
+ exit 7
fi
;;
show)
if isrunning; then
if [ $# -lt 2 ]; then
echo "Insufficient parameters"
- exit 1
+ exit 2
fi
echo -n "$2="
doPC show $2
+ exit 0
else
echo "not running"
+ exit 7
fi
;;
mrtg)
if isrunning; then
if [ $# -lt 2 ]; then
echo "Insufficient parameters"
- exit 1
+ exit 2
fi
doPC show $2
if [ "$3x" != "x" ]; then
@@ -202,8 +244,10 @@ case "$1" in
fi
doPC uptime
echo "$DESC"
+ exit 0
else
echo "not running"
+ exit 7
fi
;;
cricket)
@@ -213,8 +257,10 @@ case "$1" in
exit 1
fi
doPC show $2
+ exit 0
else
echo "not running"
+ exit 7
fi
;;
*)
More information about the Pkg-pdns-maintainers
mailing list