mirror of
https://github.com/fradelg/docker-mysql-cron-backup.git
synced 2025-01-18 08:12:34 +01:00
Changed find regex to explain date-format
This commit is contained in:
parent
400bb8c95e
commit
8eb4379305
1 changed files with 3 additions and 2 deletions
5
run.sh
5
run.sh
|
@ -11,8 +11,9 @@ elif [ -n "${INIT_RESTORE_LATEST}" ]; then
|
|||
echo "waiting database container..."
|
||||
sleep 1
|
||||
done
|
||||
# The [^l] is needed to exclude the latest backup file, and sort only data-tagged backups
|
||||
find /backup -maxdepth 1 -name '[^l]*.sql.gz' | sort | 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
|
||||
|
||||
echo "${CRON_TIME} /backup.sh >> /mysql_backup.log 2>&1" > /tmp/crontab.conf
|
||||
|
|
Loading…
Reference in a new issue