Added sort algorithm to RESTORE_LATEST script

This commit is contained in:
g.nardiello 2023-01-05 11:47:54 +01:00
parent 3011a8770a
commit 400bb8c95e

3
run.sh
View file

@ -11,7 +11,8 @@ 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 # 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 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