mirror of
https://github.com/fradelg/docker-mysql-cron-backup.git
synced 2025-01-18 08:12:34 +01:00
Added sort algorithm to RESTORE_LATEST script
This commit is contained in:
parent
3011a8770a
commit
400bb8c95e
1 changed files with 2 additions and 1 deletions
3
run.sh
3
run.sh
|
@ -11,7 +11,8 @@ 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
|
||||
# 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
|
||||
fi
|
||||
|
||||
echo "${CRON_TIME} /backup.sh >> /mysql_backup.log 2>&1" > /tmp/crontab.conf
|
||||
|
|
Loading…
Reference in a new issue