Skip to content

Instantly share code, notes, and snippets.

@talarczykco
Last active April 8, 2019 21:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save talarczykco/b75416aa2572d090a396b7b7541d854f to your computer and use it in GitHub Desktop.
Save talarczykco/b75416aa2572d090a396b7b7541d854f to your computer and use it in GitHub Desktop.

rsnapshot on macOS

Install

Run the following:

brew install rsnapshot
sudo perl -MCPAN -e'install Lchown'

Configure

Put the following in /usr/local/etc/rsnapshot.conf:

# This file requires tabs between elements
cmd_rsync       /usr/local/bin/rsync    # brew install rsync
config_version  1.2
snapshot_root   /.snapshots/

retain  hourly  8
retain  daily   7
retain  weekly  4

verbose     1
loglevel    3
lockfile    /var/run/rsnapshot.pid

backup  /home/      localhost/
backup  /etc/       localhost/
backup  /usr/local/ localhost/

Automate

Put the following in root's crontab:

# minute | hour | day of month | month | day of week
3 * * * * /usr/local/bin/rsnapshot -v hourly
2 1 * * * /usr/local/bin/rsnapshot -v daily
1 1 * * 1 /usr/local/bin/rsnapshot -v weekly
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment