From: Alan T. DeKok Date: Fri, 8 May 2009 15:17:26 +0000 (+0200) Subject: Fix radwatch for "wait" exit codes on Solaris X-Git-Tag: release_2_1_7~163 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=891b632e75d3030a0cc3b3efd2d74b45f452e41c;p=thirdparty%2Ffreeradius-server.git Fix radwatch for "wait" exit codes on Solaris --- diff --git a/scripts/radwatch.in b/scripts/radwatch.in index 90c206bb293..4724a14aacf 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