Merge branch 'master' of cloud21.cvtt.vpn:/opt/store/git/cvtt2/ops

This commit is contained in:
Oleg Sheynin 2025-05-16 11:36:33 -04:00
commit c37d62637a
4 changed files with 43 additions and 25 deletions

View File

@ -1 +1 @@
2.1.2,fix 2.1.3,remove cvttdata

View File

@ -26,10 +26,10 @@ run_checklist() {
declare -A Commands declare -A Commands
Commands=( Commands=(
["hs01:cloud21"]="ssh cvtt@hs01.cvtt.vpn ls -l /works/cvtt/md_archive/crypto/cloud21/${yr}/${mn} | tail -5" ["hs01:cloud21"]="ssh cvtt@hs01.cvtt.vpn ls -l /works/cvtt/md_archive/crypto/cloud21/${yr}/${mn} | tail -5"
["hs01:cvttdata"]="ssh cvtt@hs01.cvtt.vpn ls -l /works/cvtt/md_archive/crypto/cvttdata/${yr}/${mn} | tail -5" ["hs01:cloud28"]="ssh cvtt@hs01.cvtt.vpn ls -l /works/cvtt/md_archive/crypto/cloud28/${yr}/${mn} | tail -5"
["hs01:sim"]="ssh cvtt@hs01.cvtt.vpn ls -l /works/cvtt/md_archive/crypto/sim/ | tail -5" ["hs01:sim"]="ssh cvtt@hs01.cvtt.vpn ls -l /works/cvtt/md_archive/crypto/sim/ | tail -5"
["cloud21:cloud21"]="ssh cvtt@cloud21.cvtt.vpn ls -l /works/cvtt/md_archive/crypto/cloud21/${yr}/${mn} | tail -5" ["cloud21:cloud21"]="ssh cvtt@cloud21.cvtt.vpn ls -l /works/cvtt/md_archive/crypto/cloud21/${yr}/${mn} | tail -5"
["cloud21:cvttdata"]="ssh cvtt@cloud21.cvtt.vpn ls -l /works/cvtt/md_archive/crypto/cvttdata/${yr}/${mn} | tail -5" ["cloud21:cloud28"]="ssh cvtt@cloud21.cvtt.vpn ls -l /works/cvtt/md_archive/crypto/cloud28/${yr}/${mn} | tail -5"
["cloud21:sim"]="ssh cvtt@cloud21.cvtt.vpn ls -l /works/cvtt/md_archive/crypto/sim | tail -5" ["cloud21:sim"]="ssh cvtt@cloud21.cvtt.vpn ls -l /works/cvtt/md_archive/crypto/sim | tail -5"
["gpushnik"]="ssh oleg@gpushnik.cvtt.vpn 'ls -l /opt/jupyter_gpu/data/crypto_md | tail -10'" ["gpushnik"]="ssh oleg@gpushnik.cvtt.vpn 'ls -l /opt/jupyter_gpu/data/crypto_md | tail -10'"
) )

View File

@ -11,9 +11,10 @@ function usage {
echo Starting $0 $* echo Starting $0 $*
LogDir=${1} # ---- D e f a u l t s
LogArchiveDir=/works/archive/logs LogArchiveDir=/works/archive/logs
DateCriteria="2 days ago" DateCriteria="2 days ago"
# ---- D e f a u l t s
# ---------------- cmdline # ---------------- cmdline

View File

@ -1,40 +1,57 @@
#!/bin/bash #!/bin/bash
# FOR hosts with limited disk space - move to storage server
# FOR cloud hosts with limited disk space - move to storage server
function usage { function usage {
echo "Usage: ${0} <host> <from_dir> <days>" echo -n "Usage: ${0}"
echo -n " -H <host_label>"
echo -n " [ -A <archive_dir> (default /works/archive)]"
echo -n " [-D <older than time criteria> (default: '2 days ago')]"
echo
exit 1 exit 1
} }
echo Starting $0 $* echo Starting $0 $*
# ---- D e f a u l t s
ArchiveDir=/works/archive
DateCriteria="2 days ago"
FromHost=$(hostname -s) FromHost=$(hostname -s)
# ---- D e f a u l t s
# ---------------- cmdline
while getopts "A:H:D:" opt; do
case ${opt} in
A )
ArchiveDir=$OPTARG
;;
H )
FromHost=$OPTARG
;;
D )
DateCriteria=$OPTARG
;;
\? )
echo "Invalid option: -$OPTARG" >&2
usage
;;
: )
echo "Option -$OPTARG requires an argument." >&2
usage
;;
esac
done
# ---------------- cmdline
if [ "${FromHost}" == "" ] if [ "${FromHost}" == "" ]
then then
usage usage
fi fi
ArchiveDir=${2}
if [ "${ArchiveDir}" == "" ]
then
usage
fi
Days=${3}
if [ "${Days}" == "" ]
then
Days=2
fi
DateCriteria="${Days} days ago"
TargetHost=cloud21.cvtt.vpn TargetHost=cloud21.cvtt.vpn
TargetRootDir=/opt/store/cvtt/archive TargetRootDir=/opt/store/cvtt/archive
Oldest=$(date -d "${DateCriteria}" '+%Y-%m-%d') Oldest=$(date -d "${DateCriteria}" '+%Y-%m-%d %H:%M:%S')
Now=$(date '+%Y%m%d_%H%M%S')
echo "Looking for log files older than ${DateCriteria} in ${ArchiveDir}" echo "Looking for log files older than ${DateCriteria} in ${ArchiveDir}"
Cmd="find ${ArchiveDir}/" Cmd="find ${ArchiveDir}/"
@ -45,7 +62,7 @@ Cmd="${Cmd} -o -name '*.logs.*'"
Cmd="${Cmd} -o -name '*.tgz'" Cmd="${Cmd} -o -name '*.tgz'"
Cmd="${Cmd} ')'" Cmd="${Cmd} ')'"
Cmd="${Cmd} -type f" Cmd="${Cmd} -type f"
Cmd="${Cmd} -not -newermt ${Oldest}" Cmd="${Cmd} -not -newermt \"${Oldest}\""
echo ${Cmd} echo ${Cmd}
files=$(eval ${Cmd}) files=$(eval ${Cmd})