IS_BACKUPUPTODATE : check backup dates in the correct directory
Some checks failed
continuous-integration/drone/push Build is failing

This commit is contained in:
Jérémy Lecour 2019-11-07 10:25:12 +01:00 committed by Jérémy Lecour
parent ae30d6555c
commit eb4b03f8b1
2 changed files with 11 additions and 5 deletions

View file

@ -8,6 +8,7 @@ and this project **does not adhere to [Semantic Versioning](http://semver.org/sp
### Changed
* IS_EVOMAINTENANCE_FW : warn only if HOOK_DB is enabled
* IS_BACKUPUPTODATE : check backup dates in the correct directory
### Fixed

View file

@ -659,9 +659,14 @@ check_muninrunning() {
}
# Check if files in /home/backup/ are up-to-date
check_backupuptodate() {
if [ -d /home/backup/ ]; then
if [ -n "$(ls -A /home/backup/)" ]; then
for file in /home/backup/*; do
# find local backup directory
backup_dir=$(grep --no-messages 'LOCAL_BACKUP_DIR=' /etc/cron.daily/zzz_evobackup | tr -d \" | cut -d= -f2)
if [ -z "${backup_dir}" ]; then
backup_dir="/home/backup"
fi
if [ -d "${backup_dir}" ]; then
if [ -n "$(ls -A ${backup_dir})" ]; then
for file in ${backup_dir}/*; do
limit=$(date +"%s" -d "now - 2 day")
updated_at=$(stat -c "%Y" "$file")
@ -671,10 +676,10 @@ check_backupuptodate() {
fi
done
else
failed "IS_BACKUPUPTODATE" "/home/backup/ is empty"
failed "IS_BACKUPUPTODATE" "${backup_dir}/ is empty"
fi
else
failed "IS_BACKUPUPTODATE" "/home/backup/ is missing"
failed "IS_BACKUPUPTODATE" "${backup_dir}/ is missing"
fi
}
check_etcgit() {