sometimes do hot backups

This commit is contained in:
2026-07-25 21:31:15 +01:00
parent 7d4f8ca9c5
commit f6cfb706da
2 changed files with 18 additions and 6 deletions
+2 -1
View File
@@ -11,7 +11,8 @@ always remember to `docker compose stop` before doing any of this!
- to back up automatically, run `sudo EDITOR=micro crontab -e` and add the following:
```
TZ=UTC
0 6 * * * /home/admin/atom.town/scripts/volume-backup.sh
0 6 * * * /home/admin/atom.town/scripts/volume-backup.sh cold
0 0,12,18 * * * /home/admin/atom.town/scripts/volume-backup.sh hot
```
**restoring**
+15 -4
View File
@@ -8,19 +8,30 @@ function log() {
echo "[$(date -Iseconds)] $*" | tee -a "$LOG_FILE"
}
MODE="${1:-cold}"
if [[ "$MODE" != "cold" && "$MODE" != "hot" ]]; then
log "usage: $0 [cold|hot]" >&2
exit 1
fi
function cleanup() {
log "cleanup: starting docker services"
if [[ "$MODE" == "cold" ]]; then
log "starting docker services"
docker compose start || true
fi
log "└───── backup finished ─────┘"
}
trap cleanup EXIT
log "┌────── backup started ─────┐"
log "mode: $MODE"
cd "$WORKING_DIR"
log "stopping docker services"
docker compose stop
if [[ "$MODE" == "cold" ]]; then
log "stopping docker services"
docker compose stop
fi
log "running backup"
/usr/local/bin/vykar backup
/usr/local/bin/vykar backup 2>&1 | tee -a "$LOG_FILE"