Compare commits

...

1 commit

Author SHA1 Message Date
Alexis Ben Miloud--Josselin 43d09c3ba1 IS_BACKUPUPTODATE Check all files
Check time of last data modification of all files
under $backup_dir. That will include files like
$backup_dir/mysql/dump.sql.gz
2021-11-29 18:29:01 +01:00

View file

@ -716,12 +716,11 @@ check_backupuptodate() {
backup_dir="/home/backup"
if [ -d "${backup_dir}" ]; then
if [ -n "$(ls -A ${backup_dir})" ]; then
# shellcheck disable=SC2231
for file in ${backup_dir}/*; do
find "${backup_dir}" -type f | while read -r file; do
limit=$(date +"%s" -d "now - 2 day")
updated_at=$(stat -c "%Y" "$file")
if [ -f "$file" ] && [ "$limit" -gt "$updated_at" ]; then
if [ "$limit" -gt "$updated_at" ]; then
failed "IS_BACKUPUPTODATE" "$file has not been backed up"
test "${VERBOSE}" = 1 || break;
fi