Make Cards database restores reliable and schedule backups
A restore left the replaced database's write-ahead log in place, so SQLite replayed it and the restored file silently kept later writes. Restores now remove it, backups stay single files, and a systemd timer keeps 14 daily copies. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
d72dd38317
commit
115e62d5b2
5 changed files with 118 additions and 8 deletions
11
ops/systemd/sokko-g-cards-backup.service
Normal file
11
ops/systemd/sokko-g-cards-backup.service
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
# Rôle : sauvegarde la base Sokko TCG et garde les 14 dernières copies quotidiennes, seulement si le jeu a déjà une base.
|
||||
[Unit]
|
||||
Description=Sokko G Cards database backup
|
||||
ConditionPathExists=/var/lib/sokko-g/cards/nebula-cards.sqlite
|
||||
|
||||
[Service]
|
||||
Type=oneshot
|
||||
User=shinuwa
|
||||
WorkingDirectory=/data/webapps/sites/sokko-g
|
||||
Environment=NODE_ENV=production
|
||||
ExecStart=/home/shinuwa/.nvm/versions/node/v24.11.1/bin/node scripts/backup-nebula-cards.mjs scheduled /var/lib/sokko-g/cards/nebula-cards.sqlite /var/backups/sokko-g --keep 14
|
||||
10
ops/systemd/sokko-g-cards-backup.timer
Normal file
10
ops/systemd/sokko-g-cards-backup.timer
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
# Rôle : déclenche chaque nuit la sauvegarde Sokko TCG et rattrape une exécution manquée au redémarrage.
|
||||
[Unit]
|
||||
Description=Daily Sokko G Cards database backup
|
||||
|
||||
[Timer]
|
||||
OnCalendar=*-*-* 04:00:00
|
||||
Persistent=true
|
||||
|
||||
[Install]
|
||||
WantedBy=timers.target
|
||||
Loading…
Add table
Add a link
Reference in a new issue