forked from evolix/evocheck
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
This commit is contained in:
parent
dc17587423
commit
43d09c3ba1
|
@ -716,12 +716,11 @@ 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
|
find "${backup_dir}" -type f | while read -r file; do
|
||||||
for file in ${backup_dir}/*; 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