From 891b632e75d3030a0cc3b3efd2d74b45f452e41c Mon Sep 17 00:00:00 2001 From: "Alan T. DeKok" Date: Fri, 8 May 2009 17:17:26 +0200 Subject: [PATCH] Fix radwatch for "wait" exit codes on Solaris --- scripts/radwatch.in | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) diff --git a/scripts/radwatch.in b/scripts/radwatch.in index 90c206b..4724a14 100644 --- a/scripts/radwatch.in +++ b/scripts/radwatch.in @@ -113,7 +113,11 @@ last_email=0 while : do mysig= - trap 'mysig=yes' HUP TERM INT QUIT TSTP + trap 'mysig=1' HUP + trap 'mysig=2' INT + trap 'mysig=3' QUIT + trap 'mysig=15' TERM + trap 'mysig=18' TSTP # # The first time around, just start the server. @@ -188,7 +192,22 @@ EOF # wait $PID code=$? - + + # + # On *BSD and Linux, sending *us* a signal results in "wait" returning + # with 128+sig. On Solaris, it results in "wait" returning with "0". + # + # If this happens, we reset our expectations here so that the code + # below will work correctly. + # + if test "$code" = "0" + then + if "$mysig" != "" + then + code=`expr $mysig + 128` + fi + fi + case "$code" in 0) echo "`date +'%a %b %e %H:%M:%S %Y'` : Info: $name exited normally. Exiting" | tee -a $log_file -- 2.1.4