Add script to mark daily backup
All checks were successful
Deploy / Deploy (push) Successful in 2m18s

This commit is contained in:
2026-01-31 00:37:04 +00:00
parent ebf6b0d934
commit c49ac48205

View File

@@ -0,0 +1,23 @@
#!/usr/bin/env bash
if [ "$EUID" -ne 0 ]; then
echo "This script must be run by the root user" >&2
exit 1
fi
if docker compose run --rm init sh -c '[ ! -L /backups/latest ]'; then
# There is no latest backup, nothing to do
exit 0
fi
if docker compose run --rm init sh -c '[ -e /backups/daily ]'; then
# Daily marker exists, update it
docker compose run --rm init sh -c '
rm /backups/daily &&
cp -P /backups/latest /backups/daily
' || exit 1
else
# Daily marker does not exist, create it
docker compose run --rm init cp -P /backups/latest /backups/daily || exit 1
fi