IS_BACKUPUPTODATE Check all files
continuous-integration/drone/push Build is failing Details
continuous-integration/drone/pr Build is failing Details

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:
Alexis Ben Miloud--Josselin 2021-11-29 18:26:47 +01:00
parent dc17587423
commit 43d09c3ba1
1 changed files with 2 additions and 3 deletions

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