Restic-Script

Beispiel-Script zur Verwaltung von Backups mit Restic.

homelabrestic


#!/usr/bin/env bash

## [RESTIC] BACKUP ##
skylake() {
	export RESTIC_PASSWORD='password'
	export RESTIC_REPOSITORY='sftp:skylake@192.168.37.13:/home/restic'
	INCEXC='/home/sudoscience/restic/'
  if [ "$1" = "backup" ]; then
    /usr/bin/restic backup --files-from $INCEXC/my_backup.txt
  elif [ "$1" = "snapshots" ]; then
  	/usr/bin/restic snapshots
  elif [ "$1" = "stats" ]; then
    /usr/bin/restic stats --mode raw-data
  elif [ "$1" = "init" ]; then
  	/usr/bin/restic -r $RESTIC_REPOSITORY init
  else
    echo "[ERROR] Please specify task [init, stats, backup, snapshots]."
  fi
}
skylake "$1"