forked from evolix/evocheck
Merge pull request 'IS_BACKUPUPTODATE Check all files' (#138) from check_all_files_in_backup_dir into master
Reviewed-on: evolix/evocheck#138
This commit is contained in:
commit
bec90cb8ee
|
@ -742,12 +742,13 @@ check_backupuptodate() {
|
||||||
backup_dir="/home/backup"
|
backup_dir="/home/backup"
|
||||||
if [ -d "${backup_dir}" ]; then
|
if [ -d "${backup_dir}" ]; then
|
||||||
if [ -n "$(ls -A ${backup_dir})" ]; then
|
if [ -n "$(ls -A ${backup_dir})" ]; then
|
||||||
# shellcheck disable=SC2231
|
# Look for all files, including subdirectories.
|
||||||
for file in ${backup_dir}/*; do
|
# If this turns out to be problematic, we can go back to first level only, with --max-depth=1
|
||||||
|
find "${backup_dir}" -type f | while read -r file; do
|
||||||
limit=$(date +"%s" -d "now - 2 day")
|
limit=$(date +"%s" -d "now - 2 day")
|
||||||
updated_at=$(stat -c "%Y" "$file")
|
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"
|
failed "IS_BACKUPUPTODATE" "$file has not been backed up"
|
||||||
test "${VERBOSE}" = 1 || break;
|
test "${VERBOSE}" = 1 || break;
|
||||||
fi
|
fi
|
||||||
|
|
Loading…
Reference in a new issue