From: Adam Dickmeiss Date: Fri, 24 Oct 2003 11:19:54 +0000 (+0000) Subject: Proper check for exit code in keepalive script X-Git-Tag: YAZPP.0.7.2~3 X-Git-Url: http://git.indexdata.com/?p=yazpp-moved-to-github.git;a=commitdiff_plain;h=28897f8b6f8f69386086fb0b9f4f564d97d579a7 Proper check for exit code in keepalive script --- diff --git a/etc/yaz-proxy-ka.sh b/etc/yaz-proxy-ka.sh index 551eca7..f7bd86f 100755 --- a/etc/yaz-proxy-ka.sh +++ b/etc/yaz-proxy-ka.sh @@ -1,10 +1,38 @@ #!/bin/sh -# $Id: yaz-proxy-ka.sh,v 1.1 2003-10-24 10:33:01 adam Exp $ +# $Id: yaz-proxy-ka.sh,v 1.2 2003-10-24 11:19:54 adam Exp $ +# +# Allow core dumps when testing. +ulimit -c 200000 +# +LOGFILE=/var/log/yaz-proxy-ka.log +# +touch $LOGFILE || exit 1 i=1 -while test $i -lt 20; do - $* - test $? && exit 0 +while test $i -lt 100; do + date >>$LOGFILE + echo "Starting proxy iteration=$i" >>$LOGFILE + yaz-proxy $* + code=$? + date >>$LOGFILE + echo "Proxy Stopped. Exit code=$code" >>$LOGFILE + if test "$code" = "143"; then + echo "Got TERM. Exiting" >>$LOGFILE + exit 0 + fi + if test "$code" = "129"; then + echo "Got HUP. Exiting" >>$LOGFILE + exit 0 + fi + if test "$code" = "137"; then + echo "Got KILL. Exiting" >>$LOGFILE + exit 0 + fi + if test "$code" = "0"; then + echo "Exit 0. Exiting" >>$LOGFILE + exit 0 + fi if test -f core; then + echo "Saving core file" >>$LOGFILE mv -f core core.`date +%Y%m%d%k%M` fi sleep 1 diff --git a/etc/yaz-proxy.sh b/etc/yaz-proxy.sh index b794d06..fa6e0f0 100755 --- a/etc/yaz-proxy.sh +++ b/etc/yaz-proxy.sh @@ -1,5 +1,5 @@ #!/bin/sh -# $Id: yaz-proxy.sh,v 1.2 2003-10-24 10:33:01 adam Exp $ +# $Id: yaz-proxy.sh,v 1.3 2003-10-24 11:19:54 adam Exp $ # YAZ proxy start/stop init.d script. # PATH=/usr/local/bin:/bin:/usr/bin @@ -7,8 +7,9 @@ export PATH # Proxy CWD is here. Should be writable by it. DIR=/var/yaz-proxy -# Proxy Path -DAEMON="/usr/local/bin/yaz-proxy" +# Proxy Path (either the actual one, or the keepalive one (for testing) +DAEMON=/usr/local/bin/yaz-proxy +DAEMON=/var/yaz-proxy/yaz-proxy-ka.sh # Proxy PIDFILE. Must be writable by it. PIDFILE="/var/run/yaz-proxy.pid" @@ -29,6 +30,9 @@ if test -n "RUNAS"; then ARGS="-u $RUNAS $ARGS" fi +# Increase number of sockets, if needed +#ulimit -n 1050 + # Name, Description (not essential) NAME=yaz-proxy DESC="YAZ proxy"