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