Compare commits

..

3 Commits

Author SHA1 Message Date
Cryptoval2 d66bf5f48b 2.1.3,remove cvttdata 2025-05-16 13:28:00 +00:00
Cryptoval2 1432794197 2.1.2,fix 2025-05-15 19:40:31 +00:00
Cryptoval2 52dd9997ca 2.1.1,archive_logs interface change 2025-05-15 19:30:09 +00:00
3 changed files with 44 additions and 18 deletions
+1 -1
View File
@@ -1 +1 @@
2.0.9,prepare crypto sim enhanced 2.1.3,remove cvttdata
@@ -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'"
) )
+41 -15
View File
@@ -1,36 +1,62 @@
#!/bin/bash #!/bin/bash
function usage { function usage {
echo "Usage: ${0} <log directory> [days (default 2)]" echo -n "Usage: ${0}"
echo -n " -L <log directory>"
echo -n " [ -A <archive_logs_dir> (default /works/archive/logs)]"
echo -n " [-D <older than time criteria> (default: '2 days ago')]"
echo
exit 1 exit 1
} }
echo Starting $0 $* echo Starting $0 $*
LogDir=${1} LogDir=${1}
LogArchiveDir=/works/archive/logs
DateCriteria="2 days ago"
# ---------------- cmdline
while getopts "A:L:D:" opt; do
case ${opt} in
A )
LogArchiveDir=$OPTARG
;;
L )
LogDir=$OPTARG
;;
D )
DateCriteria=$OPTARG
;;
\? )
echo "Invalid option: -$OPTARG" >&2
usage
;;
: )
echo "Option -$OPTARG requires an argument." >&2
usage
;;
esac
done
# ---------------- cmdline
if [ "${LogDir}" == "" ] if [ "${LogDir}" == "" ]
then then
usage usage
fi fi
Days=${2} Cmd="mkdir -p ${LogArchiveDir}"
if [ "${Days}" == "" ] echo ${Cmd} && eval ${Cmd}
then
Days=2
fi
DateCriteria="${Days} days ago" echo "Looking for log files older than '${DateCriteria}' in ${LogDir}"
Oldest=$(date -d "${DateCriteria}" '+%Y-%m-%d') Oldest=$(date -d "${DateCriteria}" '+%Y-%m-%d %H:%M:%S')
echo "Looking for log files older than ${DateCriteria} in ${LogDir}" Cmd="find ${LogDir}/ '(' -name '*.log' -o -name '*.log.*' ')' -type f -not -newermt \"${Oldest}\""
echo $Cmd
LogArchiveDir=${HOME}/prod/archive/logs files=$(eval ${Cmd})
mkdir -p ${LogArchiveDir}
echo "find ${LogDir}/ '(' -name '*.log' -o -name '*.log.*' ')' -type f -not -newermt ${Oldest})"
files=$(find ${LogDir}/ '(' -name '*.log' -o -name '*.log.*' ')' -type f -not -newermt ${Oldest})
if [ "$files" == "" ] if [ "$files" == "" ]
then then
echo "No files found older than ${Oldest} in ${LogDir}" echo "No files found older than ${Oldest} in ${LogDir}"