Skip to content

Instantly share code, notes, and snippets.

@bob-swinkels
bob-swinkels / 0-restic-backup.md
Last active December 21, 2025 01:48
Example for running scheduled Restic backups on MacOS

Replace bobswinkels with your username and place files at correct locations:

  • /Users/bobswinkels/bin/backup.sh
  • /Library/LaunchDaemons/com.restic-backup.plist

Launch deamon using:
sudo launchctl load /Library/LaunchDaemons/com.restic-backup.plist

Alternatively the script can also be run using a cron job:
0 */6 * * * /Users/bobswinkels/bin/backup.sh >> /var/log/restic-backup.log 2>&1

@bob-swinkels
bob-swinkels / backup.sh
Last active March 16, 2020 20:28
Backup solution for Mac using Restic and RClone
#!/bin/bash
# Prune backups and make a new backup
if [ "$EUID" -ne 0 ] # Check if running as root
then echo "Please run as root"
exit
fi
# Exit on failure, pipe failure