Compare commits

..

3 Commits

Author SHA1 Message Date
oleg 066a9fbdf1 progress 2024-07-31 11:24:32 -04:00
oleg e7d7af1889 progress 2024-07-30 23:32:40 -04:00
oleg 797a46746c progress 2024-07-30 13:50:30 -04:00
8 changed files with 73 additions and 46 deletions
-10
View File
@@ -1,10 +0,0 @@
0 6 * * * /usr/bin/supervisorctl -c /home/cvtt/prod/config/supervisor/supervisord.conf restart config_service 2>&1 | /usr/bin/ts '[\%Y-\%m-\%d \%H:\%M:\%S]' > /home/cvtt/prod/logs/$(date +\%Y\%m\%d_\%H\%M\%S).config_service.restart.log
#
#
#---------------------- Utils
0 5 * * * /home/cvtt/prod/utils/config_svc_backup.sh 2>&1 | /usr/bin/ts '[\%Y-\%m-\%d \%H:\%M:\%S]' > /home/cvtt/prod/logs/$(date +\%Y\%m\%d_\%H\%M\%S).config_svc_backup.log
0 6 * * * /home/cvtt/prod/utils/archive_logs.sh /home/cvtt/prod/logs 2>&1 | /usr/bin/ts '[\%Y-\%m-\%d \%H:\%M:\%S]' > /home/cvtt/prod/logs/$(date +\%Y\%m\%d_\%H\%M\%S).archive_logs.log
10 1 * * * /home/cvtt/prod/utils/move_archives.sh 2>&1 | /usr/bin/ts '[\%Y-\%m-\%d \%H:\%M:\%S]' > /home/cvtt/prod/logs/$(date +\%Y\%m\%d_\%H\%M\%S).move_archives.log
#
#---------------------- T E S T
-11
View File
@@ -1,11 +0,0 @@
0 6 * * * /usr/bin/supervisorctl -c /home/cvtt/prod/config/supervisor/supervisord.conf restart all 2>&1 | /usr/bin/ts '[\%Y-\%m-\%d \%H:\%M:\%S]' > /home/cvtt/prod/logs/$(date +\%Y\%m\%d_\%H\%M\%S).bnbspot_md_recorder.restart.log
#
#10 6 * * * /usr/bin/supervisorctl -c /home/cvtt/prod/config/supervisor/supervisord.conf restart executor 2>&1 | /usr/bin/ts '[\%Y-\%m-\%d \%H:\%M:\%S]' > /home/cvtt/prod/logs/$(date +\%Y\%m\%d_\%H\%M\%S).executor_app.restart.log
#
#---------------------- Utils
0 6 * * * /home/cvtt/prod/utils/archive_logs.sh /home/cvtt/prod/logs 2>&1 | /usr/bin/ts '[\%Y-\%m-\%d \%H:\%M:\%S]' > /home/cvtt/prod/logs/$(date +\%Y\%m\%d_\%H\%M\%S).cronjob_log_archive.log
10 1 * * * /home/cvtt/prod/utils/move_archives.sh cloud17 2>&1 | /usr/bin/ts '[\%Y-\%m-\%d \%H:\%M:\%S]' > /home/cvtt/prod/logs/$(date +\%Y\%m\%d_\%H\%M\%S).move_archives.log
#
# ----------------- # TEST
#
# ----------------- # TEST
-8
View File
@@ -1,8 +0,0 @@
20 5 * * SAT /home/cvtt/prod/run/load_histdata.sh 2>&1 | /usr/bin/ts '[\%Y-\%m-\%d \%H:\%M:\%S]' >> /home/cvtt/prod/logs/$(date +\
20 6 * * SAT /home/cvtt/prod/run/prune_eqt_histdata.sh 2>&1 | /usr/bin/ts '[\%Y-\%m-\%d \%H:\%M:\%S]' >> /home/cvtt/prod/logs/$(da
#
0 6 * * SUN /home/cvtt/prod/run/archive_logs.sh /home/cvtt/prod/logs 2>&1 | /usr/bin/ts '[\%Y-\%m-\%d \%H:\%M:\%S]' > /home/cvtt/p
#
# T E S T
#----------------------------------------------------------------------
#----------------------------------------------------------------------
-11
View File
@@ -1,11 +0,0 @@
#
#---------------------- Market Data
0 6 * * * /home/cvtt/prod/run/archive_yesterday_md.sh coinbase,bnbspot,bnbfut 2>&1 > /home/cvtt/prod/logs/$(date +\%Y\%m\%d_\%H\%M\%S).archive_yestd_md.log
#---------------------- Utils
0 7 * * * /home/cvtt/prod/utils/backup_md_archive.sh 2>&1 | /usr/bin/ts '[\%Y-\%m-\%d \%H:\%M:\%S]' > /home/cvtt/prod/logs/$(date +\%Y\%m\%d_\%H\%M\%S).backup_md_archive.log
#
30 7 * * * /home/cvtt/prod/utils/archive_logs.sh /home/cvtt/prod/logs 2>&1 | /usr/bin/ts '[\%Y-\%m-\%d \%H:\%M:\%S]' > /home/cvtt/prod/logs/$(date +\%Y\%m\%d_\%H\%M\%S).cronjob_log_archive.log
#
# ----------------- # TEST
#
# ----------------- # TEST
+48
View File
@@ -0,0 +1,48 @@
#!/bin/sh
usage() {
echo "Usage: ${0} <local_root_dir>"
exit 1
}
echo "Started ${*} ..."
Domain=cvtt.vpn
RootDir=${1}
if [ ! -d "${RootDir}" ]; then
usage
fi
cd ${RootDir}
for User in cvtt oleg
do
echo "User=$User"
# hosts=$(curl -s http://cloud23.cvtt.vpn:6789/admin/cvtt_hosts | jq -r --arg domain "${Domain}" --arg usr ${User} '.[$domain] | to_entries[] | select(.value.users[] | contains($usr)) | .key')
hosts=$(
curl -s http://cloud23.cvtt.vpn:6789/admin/cvtt_hosts | jq -r \
--arg domain "${Domain}" \
--arg usr "${User}" \
'.[$domain] | to_entries[] | select(.value.users[] | contains($usr)) | .key'
)
mkdir -p ${RootDir}/${User}
for host in ${hosts}
do
echo "===================="
echo "${host}"
ssh ${User}@${host}.${Domain} 'crontab -l' | tee ${RootDir}/${User}/${host}.cron
done
done
cd ${RootDir}
Cmd="git add ."
echo ${Cmd} && eval ${Cmd}
Cmd="git commit -a -m '$(date)'"
echo ${Cmd} && eval ${Cmd}
Cmd="git pushall"
echo ${Cmd} && eval ${Cmd}
echo "${0} Done."
+5 -4
View File
@@ -37,10 +37,11 @@ fi
ContainerName="md_recorder.${job}" ContainerName="md_recorder.${job}"
if is_container_running "$ContainerName"; then if is_container_running "$ContainerName"; then
echo "Container ${ContainerName} is running." echo "Container ${ContainerName} is already running. Aborted."
exit exit
fi fi
Cmd="docker run" Cmd="docker run"
Cmd="${Cmd} -d" Cmd="${Cmd} -d"
+19 -1
View File
@@ -17,6 +17,18 @@ is_valid() {
return 1 return 1
} }
is_container_running() {
local container_name=$1
if [ "$(docker ps --filter "name=^/${container_name}$" --filter "status=running" -q)" ]; then
return 0 # true
else
return 1 # false
fi
}
Instance=${1} Instance=${1}
if ! is_valid "${Instance}"; then if ! is_valid "${Instance}"; then
@@ -28,13 +40,19 @@ if [ "${2}" != "" ]; then
AdminPort=${2} AdminPort=${2}
fi fi
ContainerName="md_recorder_monitor.${Instance}"
if is_container_running "$ContainerName"; then
echo "Container ${ContainerName} is already running. Aborted."
exit
fi
Cmd="docker run" Cmd="docker run"
Cmd="${Cmd} -d" Cmd="${Cmd} -d"
Cmd="${Cmd} --rm" Cmd="${Cmd} --rm"
Cmd="${Cmd} --network=host" Cmd="${Cmd} --network=host"
Cmd="${Cmd} --pull=always" Cmd="${Cmd} --pull=always"
Cmd="${Cmd} --name=md_recorder_monitor.${Instance}" Cmd="${Cmd} --name=${ContainerName}"
Cmd="${Cmd} -v /home/cvtt/prod/logs:/logs" Cmd="${Cmd} -v /home/cvtt/prod/logs:/logs"
Cmd="${Cmd} cloud21.cvtt.vpn:5500/md_recorder_monitor:latest" Cmd="${Cmd} cloud21.cvtt.vpn:5500/md_recorder_monitor:latest"
Cmd="${Cmd} ${Instance} ${AdminPort}" Cmd="${Cmd} ${Instance} ${AdminPort}"
+1 -1
View File
@@ -1 +1 @@
1.2.4 1.2.6