test if it's a file, to ignore directories

This commit is contained in:
Jérémy Lecour 2019-03-22 14:07:47 +01:00 committed by Jérémy Lecour
parent c3b4efd71e
commit 2ad82591f3

View file

@ -721,8 +721,8 @@ if is_debian; then
for file in /home/backup/*; do
limit=$(date +"%s" -d "now - 2 day")
updated_at=$(stat -c "%Y" $file)
if [ $limit -gt $updated_at ]; then
failed "IS_BACKUPUPTODATE"
if [ -f "$file" ] && [ $limit -gt $updated_at ]; then
failed "IS_BACKUPUPTODATE" "$file has not been backed up"
break;
fi
done