#!/bin/bash # Backup script that uses rsync, taken from https://wiki.archlinux.org/index.php/Rsync#As_a_backup_utility # This script should be run daily with cron or a systemd timer. [ -z "$SETUP_COCKPIT_USER" ] && echo "SETUP_COCKPIT_USER was not set, quitting" && exit 1 [ -z "$RSYNC_BACKUP_SRC" ] && echo "RSYNC_BACKUP_SRC was not set, quitting" && exit 1 [ -z "$RSYNC_BACKUP_DEST" ] && echo "RSYNC_BACKUP_DEST was not set, quitting" && exit 1 rsync -a --delete --quiet --exclude-from=/home/"$SETUP_COCKPIT_USER"/setup-cockpit/rsync_backup_excludes "$RSYNC_BACKUP_SRC" "$RSYNC_BACKUP_DEST"