Added check script
This commit is contained in:
parent
9309c372bf
commit
393d9efae0
14
README.md
14
README.md
|
@ -1,13 +1,13 @@
|
|||
# foxBackup
|
||||
|
||||
### keys
|
||||
## keys
|
||||
|
||||
-f = full backup (if not = increment)
|
||||
|
||||
-q - suppress logs output
|
||||
|
||||
|
||||
### config options
|
||||
## config options
|
||||
|
||||
sqldump_prefix="docker exec -t db mysqldump" = prefix for sqldump
|
||||
|
||||
|
@ -27,3 +27,13 @@ sshkey='/path_to_ssh_private_key';
|
|||
|
||||
sshpath='/media/hdd2/backup'; = remote path for SCP store
|
||||
|
||||
# Check
|
||||
|
||||
Run at backup storage, checks expired backups in all forders with prefix backup- in ``prefix`` folder.
|
||||
|
||||
All deltas calculated from file names!
|
||||
|
||||
## Config
|
||||
prefix='/mnt/backups'; # Storage prefix
|
||||
dailySecMax=936000; # DailyDelta in seconds
|
||||
fullSecMax=29376000; # FullDelta in seconds
|
||||
|
|
|
@ -0,0 +1,42 @@
|
|||
#!/bin/bash
|
||||
|
||||
ABSOLUTE_FILENAME=`readlink -e "$0"`
|
||||
DIRECTORY=`dirname "$ABSOLUTE_FILENAME"`
|
||||
|
||||
source ${DIRECTORY}/config
|
||||
currStamp=`date +%s`
|
||||
|
||||
for backup_dir in `ls -d ${prefix}/backup-*`
|
||||
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
|
||||
|
|
@ -0,0 +1,6 @@
|
|||
prefix='/mnt/backups';
|
||||
# 26Hrs
|
||||
dailySecMax=936000;
|
||||
# 34Days
|
||||
fullSecMax=29376000;
|
||||
|
Loading…
Reference in New Issue