diff --git a/run.sh b/run.sh index 6882b95..c65f1f4 100755 --- a/run.sh +++ b/run.sh @@ -11,7 +11,9 @@ elif [ -n "${INIT_RESTORE_LATEST}" ]; then echo "waiting database container..." sleep 1 done - find /backup -maxdepth 1 -name '*.sql.gz' | tail -1 | xargs /restore.sh + # Needed to exclude the 'latest..sql.gz' file, consider only filenames starting with number + # Only data-tagged backups, eg. '202212250457.database.sql.gz', must be trapped by the regex + find /backup -maxdepth 1 -name '[0-9]*.*.sql.gz' | sort | tail -1 | xargs /restore.sh fi echo "${CRON_TIME} /backup.sh >> /mysql_backup.log 2>&1" > /tmp/crontab.conf