#!/bin/bash read_config() { # variables #CACHE_DIR="$HOME/.cache/restic" #BACKUP_PATHS="/etc /home/docker/volumes /root" #BACKUP_EXCLUDES="-e /home/docker/volumes/syncthing" #KEEP_HOURS=96 #KEEP_DAYS=31 #KEEP_WEEKS=8 #KEEP_MONTHS=12 #KEEP_YEARS=3 #RESTIC_PASSWORD="PASSWORD" #RESTIC_REPOSITORY="sftp://foo@${BACKUP_SERVER}:22//home/bar" # or for b2 #RESTIC_REPOSITORY="b2:backup" #B2_ACCOUNT_ID="ID" #B2_ACCOUNT_KEY="KEY" if [[ ! -f "/etc/restic/env" && ! -f "$HOME/.config/restic/env" ]]; then echo "no config provided" exit 1 fi . $HOME/.config/restic/env 2> /dev/null || . /etc/restic/env 2> /dev/null } info() { printf "\n\e[1m%s\e[0m\n" "$*" >&2; } info "Testing if restic is already running..." if pgrep -x "restic" &> /dev/null; then echo "Restic is already runnning" exit 1 fi echo "Done" info "Updating restic..." restic self-update echo "Done" info "60s delay (in case we just woke up)..." sleep 60 echo "Done" read_config