diff --git a/scripts/config_server_start.sh b/scripts/config_server_start.sh index b587962..bf4f3ed 100755 --- a/scripts/config_server_start.sh +++ b/scripts/config_server_start.sh @@ -49,20 +49,20 @@ ServicePort=6789 ServiceDir=${CfgSvcDir}/data LogDir=${RootDir}/logs - export PYTHONPATH="${RootDir}:${PYTHONPATH}" Cmd="nohup" Cmd="${Cmd} python3" Cmd="${Cmd} ${ServerPy}" Cmd="${Cmd} --port=${ServicePort}" +Cmd="${Cmd} --root=${ServiceDir}" function check_it { if !(timeout 3 curl -s localhost:${AdminPort}/ping > /dev/null) then echo "${Script} doesn't respond. restarting..." - pids=$(ps -ef | grep "--port=${ServicePort}" | grep -v grep | tr -s ' ' |cut -d' ' -f2) + pids=$(ps -ef | grep "port=${ServicePort}" | grep "root=${ServiceDir}" | grep -v grep | tr -s ' ' |cut -d' ' -f2) echo pids=${pids} if [ "${pids}" != "" ] then @@ -76,7 +76,7 @@ function check_it { function start_it { if !(timeout 3 curl -s localhost:${AdminPort}/ping > /dev/null) then - pids=$(ps -ef | grep "--port=${ServicePort}" | grep -v grep | tr -s ' ' |cut -d' ' -f2) + pids=$(ps -ef |grep $(basename ${0}) |grep -v ${$} |grep -v grep |tr -s ' ' |cut -d' ' -f2) if [ "${pids}" != "" ] then echo "${0} is already running. pids=(${pids}). Use --restart" @@ -93,7 +93,7 @@ function start_it { } function kill_it { - pids=$(ps -ef |grep "inst_set=${InstrSet}" |grep $(basename ${0}) |grep -v ${$} |grep -v grep |tr -s ' ' |cut -d' ' -f2) + pids=$(ps -ef |grep $(basename ${0}) |grep -v ${$} |grep -v grep |tr -s ' ' |cut -d' ' -f2) if [ "${pids}" != "" ] then @@ -121,15 +121,10 @@ fi if [ "${Restart}" == "Y" ] then kill_it -else - pids=$(ps -ef |grep "inst_set=${InstrSet}" |grep $(basename ${0}) |grep -v ${$} |grep -v grep |tr -s ' ' |cut -d' ' -f2) - if [ "${pids}" != "" ] - then - echo "${0} is already running. pids=(${pids}). Use --restart" - exit 0 - fi fi +start_it + while true do check_it diff --git a/scripts/md_recorder_start.sh b/scripts/md_recorder_start.sh index 4ea7f48..18bb124 100644 --- a/scripts/md_recorder_start.sh +++ b/scripts/md_recorder_start.sh @@ -13,6 +13,14 @@ do Restart=Y shift ;; + --stop) + Stop="Y" + shift + ;; + --once) + Once="Y" + shift + ;; --inst_set=*) InstrSet="${arg#*=}" shift @@ -95,6 +103,7 @@ function check_it { pids=$(ps -ef |grep "inst_set=${InstrSet}" |grep $(basename ${0}) |grep -v ${$} |grep -v grep |tr -s ' ' |cut -d' ' -f2) if [ "${Restart}" == "Y" ] then + kill_it if [ "${pids}" != "" ] then echo "Killing ${pids} ..." @@ -113,6 +122,7 @@ else fi fi +start_it while true do check_it