mirror of
https://github.com/fradelg/docker-mysql-cron-backup.git
synced 2025-01-18 16:22:33 +01:00
Merge pull request #92 from g-nardiello/patch-restore-latest-sort
[Bugfix] RESTORE_LATEST script sorted by backup date
This commit is contained in:
commit
8d2e012667
1 changed files with 3 additions and 1 deletions
4
run.sh
4
run.sh
|
@ -11,7 +11,9 @@ elif [ -n "${INIT_RESTORE_LATEST}" ]; then
|
||||||
echo "waiting database container..."
|
echo "waiting database container..."
|
||||||
sleep 1
|
sleep 1
|
||||||
done
|
done
|
||||||
find /backup -maxdepth 1 -name '*.sql.gz' | tail -1 | xargs /restore.sh
|
# Needed to exclude the 'latest.<database>.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
|
fi
|
||||||
|
|
||||||
echo "${CRON_TIME} /backup.sh >> /mysql_backup.log 2>&1" > /tmp/crontab.conf
|
echo "${CRON_TIME} /backup.sh >> /mysql_backup.log 2>&1" > /tmp/crontab.conf
|
||||||
|
|
Loading…
Reference in a new issue