#!/usr/bin/env bash # Restore Spendlight from a backup when the app itself can't be used. For an # everyday restore, use Settings → Backups instead. # # scripts/restore.sh spendlight-nightly-20261007-023000.db # # The file must be in the backups folder. A "before restore" copy of the # current database is saved there first. set -euo pipefail cd "$(dirname "$0")/.." name="$(basename "${1:?Usage: scripts/restore.sh }")" docker compose stop spendlight if ! docker compose run --rm --no-deps spendlight spendlight restore "/backups/${name}"; then docker compose start spendlight exit 1 fi docker compose start spendlight echo "Spendlight is running again on the restored data."