Make date in backup filename ISO 8601 compliant

By making the date in backup filename ISO 8601 compliant (year-month-day) an alphabetical sort of the backups automatically will be a chronological sort of the backups. This is more convenient.

As the automatic deletion of backups older than 60 days relies on the modified date of the file (and not the filename), this will continue to work without problems.

See also: https://www.xkcd.com/1179/
This commit is contained in:
Stefan 2024-09-01 17:16:53 +02:00
parent 2bc58e083d
commit ad20a96e00

View File

@ -9,7 +9,7 @@ set -e
shopt -s extglob
pushd `dirname $0` > /dev/null
backupBundleFileName="backup-`date +%d-%m-%Y-%H-%M-%S`.tgz"
backupBundleFileName="backup_`date +%Y-%m-%d_%H-%M-%S`.tgz"
echo Making a backup of the current installation in ./data/backups/$backupBundleFileName
mkdir -p ./data/backups > /dev/null
touch ./data/backups/$backupBundleFileName