Compare commits

...

4 Commits

Author SHA1 Message Date
oleg fa6dd0fa95 fix 2024-07-25 10:22:51 -04:00
oleg ce68165eef fix 2024-07-24 19:57:30 -04:00
oleg 3932cbde37 fix 2024-07-24 13:53:26 -04:00
oleg 9e90186432 progress 2024-07-24 13:30:17 -04:00
3 changed files with 34 additions and 9 deletions
+1 -1
View File
@@ -1 +1 @@
1.0.5 1.0.9
+32 -8
View File
@@ -19,8 +19,17 @@ is_container_running() {
if [ -z ${date_to_load} ] ; then if [ -z ${date_to_load} ] ; then
echo "Yesterday data has priority. Running historical container will be killed" echo "Yesterday data has priority. Running historical container will be stopped"
docker kill ${ContainerName} Cmd="docker stop ${ContainerName}"
echo ${Cmd} && eval ${Cmd}
Cmd="docker ps"
echo ${Cmd} && eval ${Cmd}
if is_container_running "$ContainerName"; then
echo "Container ${ContainerName} is still running."
exit 3
fi
else else
echo "Historical run ${date_to_load}" echo "Historical run ${date_to_load}"
if is_container_running "$ContainerName"; then if is_container_running "$ContainerName"; then
@@ -29,14 +38,26 @@ else
fi fi
if [ "${date_to_load}" == "next" ] ; then if [ "${date_to_load}" == "next" ] ; then
if [ ! -e ${LastDayFile} ]; then if [ ! -e ${LastDayFile} ]; then
mv ${LastDayFile}.prev ${LastDayFile} echo "File ${LastDayFile} does not exist. Will try to use prev file."
if [ ! -e ${LastDayFile} ]; then if [ ! -e ${LastDayFile}.prev ]; then
echo "file ${LastDayFile} does not exist" echo "File ${LastDayFile}.prev does not exist. Aborted."
exit 2 exit 2
fi fi
mv ${LastDayFile}.prev ${LastDayFile}
fi fi
last_date=$(cat ${LastDayFile}) last_date=$(cat ${LastDayFile} | xargs)
if [ -z ${last_date} ] ; then if [ -z "${last_date}" ] ; then
echo "File ${LastDayFile} returned an empty last day. Will try to use prev file."
if [ ! -e ${LastDayFile}.prev ]; then
echo "File ${LastDayFile}.prev does not exist. Aborted."
exit 2
fi
mv ${LastDayFile}.prev ${LastDayFile}
last_date=$(cat ${LastDayFile} | xargs)
if [ -z "${last_date}" ] ; then
echo "Unable to obtain last_date. Aborted"
exit 3
fi
echo "No last date_to_load in ${LastDayFile}" echo "No last date_to_load in ${LastDayFile}"
exit 1 exit 1
fi fi
@@ -47,6 +68,7 @@ else
fi fi
Cmd="docker run" Cmd="docker run"
Cmd="${Cmd} --pull=always"
Cmd="${Cmd} --network=host" Cmd="${Cmd} --network=host"
Cmd="${Cmd} --name=${ContainerName}" Cmd="${Cmd} --name=${ContainerName}"
Cmd="${Cmd} --rm" Cmd="${Cmd} --rm"
@@ -60,7 +82,9 @@ if [ "$?" != "0" ] ; then
exit 1 # if killed we do not save last day exit 1 # if killed we do not save last day
fi fi
if [ -n ${date_to_load} ]; then # truncate to avoid false positive
date_to_load=$(echo "${date_to_load}" | xargs)
if [ -n "${date_to_load}" ]; then
echo "Saving date_to_load to ${LastDayFile}" echo "Saving date_to_load to ${LastDayFile}"
echo ${date_to_load} > ${LastDayFile} echo ${date_to_load} > ${LastDayFile}
fi fi
+1
View File
@@ -11,6 +11,7 @@ if [ -z ${date} ] ; then
fi fi
Cmd="docker run" Cmd="docker run"
Cmd="${Cmd} --pull=always"
Cmd="${Cmd} --network=host" Cmd="${Cmd} --network=host"
Cmd="${Cmd} --name=crypto_md_day.${host}.${date}" Cmd="${Cmd} --name=crypto_md_day.${host}.${date}"
Cmd="${Cmd} --rm" Cmd="${Cmd} --rm"