log file added

This commit is contained in:
Oleg Sheynin 2023-04-24 17:55:23 -04:00
parent 2fe4a78fab
commit 4c9dcc111b
2 changed files with 9 additions and 22 deletions

View File

@ -1 +1 @@
0.0.5 0.0.6

View File

@ -57,39 +57,26 @@ Cmd="${Cmd} python3"
Cmd="${Cmd} ${ServerPy}" Cmd="${Cmd} ${ServerPy}"
Cmd="${Cmd} --port=${ServicePort}" Cmd="${Cmd} --port=${ServicePort}"
Cmd="${Cmd} --root=${ServiceDir}" Cmd="${Cmd} --root=${ServiceDir}"
Cmd="${Cmd} --log_file=${LogDir}/%T.config_service.log"
function start_it {
echo ${Cmd}
eval ${Cmd} &
sleep 10
}
function check_it { function check_it {
if !(timeout 3 curl -s localhost:${AdminPort}/ping > /dev/null) if !(timeout 3 curl -s localhost:${AdminPort}/ping > /dev/null)
then then
echo "${Script} doesn't respond. restarting..." echo "${Script} doesn't respond. restarting..."
start_app
pids=$(ps -ef | grep "port=${ServicePort}" | grep "root=${ServiceDir}" | 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} echo pids=${pids}
if [ "${pids}" != "" ] if [ "${pids}" != "" ]
then then
kill -9 ${pids} kill -9 ${pids}
fi fi
echo ${Cmd} start_it
eval ${Cmd} && sleep 10
fi
}
function start_it {
if !(timeout 3 curl -s localhost:${AdminPort}/ping > /dev/null)
then
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"
exit 0
fi
echo pids=${pids}
if [ "${pids}" != "" ]
then
kill -9 ${pids}
fi
echo ${Cmd}
eval ${Cmd} && sleep 10
fi fi
} }