progress
This commit is contained in:
parent
5a8ce24ad1
commit
ee3f7dc218
@ -1 +1 @@
|
||||
0.1.2.1
|
||||
0.1.3
|
||||
@ -2,7 +2,7 @@
|
||||
Script="${0} ${*}"
|
||||
|
||||
function usage {
|
||||
echo "Usage: ${0} --inst_set=<setting #> [--restart] [--sleep_sec=<num_seconds>]"
|
||||
echo "Usage: ${0} --inst_set=<setting #> [--restart] [--stop] [--once] [--sleep_sec=<num_seconds>]"
|
||||
exit 1
|
||||
}
|
||||
|
||||
@ -70,6 +70,7 @@ AdminPort="720${InstrSet}"
|
||||
LogFile="${RootDir}/mmaker/logs/$(date '+%Y%m%d_%H%M%S').influx_rec.coinbs_${InstrSet}.log"
|
||||
Exchange=COINBASE
|
||||
|
||||
source ${HOME}/.pyenv/python3.10-venv/bin/activate
|
||||
export PYTHONPATH=${RootDir}
|
||||
|
||||
Cmd="nohup"
|
||||
@ -83,6 +84,12 @@ Cmd="${Cmd} --log_level=INFO"
|
||||
Cmd="${Cmd} --log_file=${LogFile}"
|
||||
Cmd="${Cmd} &"
|
||||
|
||||
function start_it {
|
||||
echo ${Cmd}
|
||||
eval ${Cmd} &
|
||||
sleep 10
|
||||
}
|
||||
|
||||
|
||||
function check_it {
|
||||
|
||||
@ -95,15 +102,13 @@ function check_it {
|
||||
then
|
||||
kill -9 ${pids}
|
||||
fi
|
||||
echo ${Cmd}
|
||||
eval ${Cmd} && sleep 10
|
||||
start_it
|
||||
fi
|
||||
}
|
||||
|
||||
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
|
||||
function kill_it {
|
||||
pids=$(ps -ef |grep "inst_set=${InstrSet}" |grep $(basename ${0}) |grep -v ${$} |grep -v grep |tr -s ' ' |cut -d' ' -f2)
|
||||
|
||||
if [ "${pids}" != "" ]
|
||||
then
|
||||
echo "Killing ${pids} ..."
|
||||
@ -112,14 +117,31 @@ then
|
||||
while (timeout 3 curl -s localhost:${AdminPort}/ping > /dev/null)
|
||||
do
|
||||
echo "Shutting down localhost:${AdminPort}/shutdown ..."
|
||||
timeout 10 curl -s localhost:${AdminPort}/shutdown
|
||||
timeout 5 curl -s localhost:${AdminPort}/shutdown
|
||||
|
||||
pids=$(ps -ef | grep "admin_port=${AdminPort}" | grep -v grep | tr -s ' ' |cut -d' ' -f2)
|
||||
echo pids=${pids}
|
||||
if [ "${pids}" != "" ]
|
||||
then
|
||||
kill -9 ${pids}
|
||||
fi
|
||||
done
|
||||
else
|
||||
if [ "${pids}" != "" ]
|
||||
then
|
||||
echo "${0} is already running. pids=(${pids}). Use --restart"
|
||||
exit 0
|
||||
fi
|
||||
}
|
||||
|
||||
if [ "${Stop}" == "Y" ] ; then
|
||||
kill_it
|
||||
exit 0
|
||||
fi
|
||||
|
||||
if [ "${Once}" == "Y" ] ; then
|
||||
start_it
|
||||
exit 0
|
||||
fi
|
||||
|
||||
|
||||
if [ "${Restart}" == "Y" ]
|
||||
then
|
||||
kill_it
|
||||
fi
|
||||
|
||||
start_it
|
||||
@ -129,3 +151,5 @@ do
|
||||
echo "${Script} is checked" | /usr/bin/ts '[%Y-%m-%d %H:%M:%S]'
|
||||
sleep ${SleepSec}
|
||||
done
|
||||
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user