2021-12-12 11:24:14 +00:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
ABSOLUTE_FILENAME=`readlink -e "$0"`
|
|
|
|
DIRECTORY=`dirname "$ABSOLUTE_FILENAME"`
|
|
|
|
|
|
|
|
source ${DIRECTORY}/config
|
|
|
|
currStamp=`date +%s`
|
|
|
|
|
2021-12-16 14:45:09 +00:00
|
|
|
list=`ls -d ${prefix}/backup-*`
|
|
|
|
|
|
|
|
if [ "$?" != 0 ]
|
|
|
|
then
|
|
|
|
echo "FAIL - Directory listnig failed!"
|
|
|
|
exit
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
|
|
for backup_dir in ${list}
|
2021-12-12 11:24:14 +00:00
|
|
|
do
|
|
|
|
echo Directory ${backup_dir}:
|
|
|
|
lastFull=`cd ${backup_dir}/ && ls -t *-[F].t* 2>/dev/null | head -n 1`
|
|
|
|
lastDaily=`cd ${backup_dir}/ && ls -t *-[DI].t* 2>/dev/null | head -n 1`
|
|
|
|
echo LF: ${lastFull:-WARN == FULL NOT FOUND}
|
|
|
|
echo LD: ${lastDaily:-WARN == DAILY NOT FOUND}
|
|
|
|
if [[ -n ${lastFull} ]]
|
|
|
|
then
|
|
|
|
lastFullStamp=`echo ${lastFull} | awk -F '-' '{ print $1 }'`
|
|
|
|
lastFullDelta=`expr ${currStamp} - ${lastFullStamp}`
|
|
|
|
if [ "${fullSecMax}" -gt "${lastFullDelta}" ]
|
|
|
|
then
|
|
|
|
echo "OK - Full delta ${lastFullDelta} OK"
|
|
|
|
else
|
|
|
|
echo "FAIL == LAST FULL EXPIRED"
|
|
|
|
fi
|
|
|
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [[ -n ${lastDaily} ]]
|
|
|
|
then
|
|
|
|
lastDailyStamp=`echo ${lastDaily} | awk -F '-' '{ print $1 }'`
|
|
|
|
lastDailyDelta=`expr ${currStamp} - ${lastDailyStamp}`
|
|
|
|
if [ "${dailySecMax}" -gt "${lastDailyDelta}" ]
|
|
|
|
then
|
|
|
|
echo "OK - Daily delta ${lastDailyDelta} OK"
|
|
|
|
else
|
|
|
|
echo "FAIL == LAST DAILY EXPIRED"
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
|
|
|
done
|
|
|
|
|