implement basic automatic backup
This commit is contained in:
@@ -0,0 +1,26 @@
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
|
||||
THINGY_DIR="/home/fedora/thingy" # todo: better
|
||||
LOG_FILE="/var/log/volume-backup.log"
|
||||
|
||||
function log() {
|
||||
echo "[$(date -Iseconds)] $*" | tee -a "$LOG_FILE"
|
||||
}
|
||||
|
||||
function cleanup() {
|
||||
log "cleanup: starting docker services"
|
||||
docker compose start || true
|
||||
log "└───── backup finished ─────┘"
|
||||
}
|
||||
trap cleanup EXIT
|
||||
|
||||
log "┌────── backup started ─────┐"
|
||||
|
||||
cd "$THINGY_DIR"
|
||||
|
||||
log "stopping docker services"
|
||||
docker compose stop
|
||||
|
||||
log "running backup"
|
||||
/usr/local/bin/vykar backup
|
||||
Reference in New Issue
Block a user