From 5f6b5a06f154823775e81cb9c251899ffe2da6c4 Mon Sep 17 00:00:00 2001 From: David Schroeder Date: Sat, 15 Feb 2020 23:34:32 -0600 Subject: [PATCH] Update mysqlbu-scripts.sh --- mysqlbu-scripts.sh | 38 ++++++++++++++++++-------------------- 1 file changed, 18 insertions(+), 20 deletions(-) diff --git a/mysqlbu-scripts.sh b/mysqlbu-scripts.sh index 2f6a86b..af1494d 100755 --- a/mysqlbu-scripts.sh +++ b/mysqlbu-scripts.sh @@ -168,25 +168,23 @@ DELETE_MENU() { echo -e "${idsCL[LightYellow]}========== Select Which Backup to Delete ==========${idsCL[Default]}" tba=1 for day in $BACKUP_PATH/* ; do - if [ "${day}" != *"latest"* ]; then - #tdt=`sed 's/.*\///' <<< $day` - tdt=`echo $day | sed 's/.*\///'` - bsz=`du -sh ${day} | awk '{print $1}'` - echo -e "${idsBG[Blue]}${idsCL[LightYellow]}(${tba})${idsCL[White]} -> `date -d"${tdt}" +"%A, %B %d, %Y"` - ${bsz} ${idsCL[Default]}${idsBG[Default]}" - tbb=0 - for hour in $day/* ; do - #thr=`sed 's/.*\///' <<< ${hour//_BASE/}` - thr=`echo ${hour//_BASE/} | sed 's/.*\///'` - bsz=`du -sh ${hour} | awk '{print $1}'` - if [ ${hour: -5} = "_BASE" ]; then - echo -e "${idsCL[LightYellow]}(${tba}${abet[${tbb}]^^})${idsCL[LightGreen]}${idsST[Bold]} -> `date -d"${tdt} ${thr//-/:}" +"%H:%M"` - FULL BACKUP${idsST[Reset]}${idsCL[LightGreen]} - ${bsz}${idsCL[Default]}" - else - echo -e "${idsCL[LightYellow]}(${tba}${abet[${tbb}]^^})${idsCL[Cyan]} -> `date -d"${tdt} ${thr//-/:}" +"%H:%M"` - Incremental - ${bsz}${idsCL[Default]}" - fi - tbb=`expr $tbb + 1` - done - tba=`expr $tba + 1` - fi + #tdt=`sed 's/.*\///' <<< $day` + tdt=`echo $day | sed 's/.*\///'` + bsz=`du -sh ${day} | awk '{print $1}'` + echo -e "${idsBG[Blue]}${idsCL[LightYellow]}(${tba})${idsCL[White]} -> `date -d"${tdt}" +"%A, %B %d, %Y"` - ${bsz} ${idsCL[Default]}${idsBG[Default]}" + tbb=0 + for hour in $day/* ; do + #thr=`sed 's/.*\///' <<< ${hour//_BASE/}` + thr=`echo ${hour//_BASE/} | sed 's/.*\///'` + bsz=`du -sh ${hour} | awk '{print $1}'` + if [ ${hour: -5} = "_BASE" ]; then + echo -e "${idsCL[LightYellow]}(${tba}${abet[${tbb}]^^})${idsCL[LightGreen]}${idsST[Bold]} -> `date -d"${tdt} ${thr//-/:}" +"%H:%M"` - FULL BACKUP${idsST[Reset]}${idsCL[LightGreen]} - ${bsz}${idsCL[Default]}" + else + echo -e "${idsCL[LightYellow]}(${tba}${abet[${tbb}]^^})${idsCL[Cyan]} -> `date -d"${tdt} ${thr//-/:}" +"%H:%M"` - Incremental - ${bsz}${idsCL[Default]}" + fi + tbb=`expr $tbb + 1` + done + tba=`expr $tba + 1` done echo -e "${idsCL[Yellow]}===================================================${idsCL[Default]}" echo "" @@ -317,7 +315,7 @@ case $1 in echo -e "${idsCL[Yellow]}Storage space used by all backups - ${bsz} ${idsCL[Default]}" echo -e "${idsCL[LightYellow]}-------------------------------------------------${idsCL[Default]}" for day in $BACKUP_PATH/* ; do - if [ "${day}" != *"latest"* ]; then + if [ "${day}" != "${BACKUP_PATH}/latest" ]; then tdt=`sed 's/.*\///' <<< $day` bsz=`du -sh ${day} | awk '{print $1}'` echo -e "${idsBG[Blue]}${idsCL[White]}-> `date -d"${tdt}" +"%a, %B %d, %Y"` - ${bsz} ${idsCL[Default]}${idsBG[Default]}"