From: Clayton Liddell Date: Wed, 16 Dec 2020 22:12:44 +0000 (-0600) Subject: LP#1908455 - Prevent multiple server processes X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=6e732fef971aec3fa392bd27a66bb6431d37d4ee;p=Evergreen.git LP#1908455 - Prevent multiple server processes Check for the existence of a server process before creating a new server process in oils_ctl.sh. Signed-off-by: Clayton Liddell Signed-off-by: Jason Boyer --- diff --git a/Open-ILS/examples/oils_ctl.sh b/Open-ILS/examples/oils_ctl.sh index c6bab4b42d..0e80af864d 100755 --- a/Open-ILS/examples/oils_ctl.sh +++ b/Open-ILS/examples/oils_ctl.sh @@ -76,7 +76,7 @@ function do_action { if [ -e $pidfile ]; then pid=$(cat $pidfile); echo "$item already started : $pid"; - return 0; + return 1; fi; echo "Starting $item"; fi; @@ -85,7 +85,7 @@ function do_action { if [ ! -e $pidfile ]; then echo "$item not running"; - return 0; + return 1; fi; pid=$(cat $pidfile); @@ -105,13 +105,14 @@ function do_action { function start_sip { - do_action "start" $PID_SIP "OILS SIP Server"; - DIR=$(pwd); - cd $SIP_DIR; - perl SIPServer.pm "$OPT_SIP_CONFIG" >> "$OPT_SIP_ERR_LOG" 2>&1 & - pid=$!; - cd $DIR; - echo $pid > $PID_SIP; + if do_action "start" $PID_SIP "OILS SIP Server"; then + DIR=$(pwd); + cd $SIP_DIR; + perl SIPServer.pm "$OPT_SIP_CONFIG" >> "$OPT_SIP_ERR_LOG" 2>&1 & + pid=$!; + cd $DIR; + echo $pid > $PID_SIP; + fi return 0; } @@ -121,10 +122,11 @@ function stop_sip { } function start_z3950 { - do_action "start" $PID_Z3950 "OILS Z39.50 Server"; - simple2zoom -c $OPT_Z3950_CONFIG -- -f $OPT_YAZ_CONFIG >> "$Z3950_LOG" 2>&1 & - pid=$!; - echo $pid > $PID_Z3950; + if do_action "start" $PID_Z3950 "OILS Z39.50 Server"; then + simple2zoom -c $OPT_Z3950_CONFIG -- -f $OPT_YAZ_CONFIG >> "$Z3950_LOG" 2>&1 & + pid=$!; + echo $pid > $PID_Z3950; + fi return 0; }