Skip to content

Instantly share code, notes, and snippets.

@tristanseifert
Last active April 6, 2018 00:59
Show Gist options
  • Save tristanseifert/e2ab0e8f7061f32ac57cec998540e707 to your computer and use it in GitHub Desktop.
Save tristanseifert/e2ab0e8f7061f32ac57cec998540e707 to your computer and use it in GitHub Desktop.
backup script
#!/bin/sh
# create snapshot
zfSnap -d -s -S -a 2m tank/data
# determine latest snapshot
BACKUPDIR=$(ls -td /mnt/tank/data/.zfs/snapshot/*/ | sort -r | head -1)
echo "Selected $BACKUPDIR for rsync backup..."
# invoke rclone
rclone sync --transfers=8 --checkers=4 --drive-chunk-size=32768k --exclude-from ~/rclone-tank-exclusions.txt --bwlimit 1M $BACKUPDIR secret: --config=/usr/local/etc/backups/rclone.conf
# ignore disk images
*.sparseimage
# ignore log files
*.log
# /usr/local/etc/backups/rclone.conf
# you would generate this config file with rclone's setup wizard
#
[remote]
type = drive
client_id = xxxxx
client_secret = xxxxx
token = {"access_token":"xxxxx","token_type":"Bearer","refresh_token":"xxxxx","expiry":"2018-04-04T18:09:32.141530416-05:00"}
[secret]
type = crypt
remote = remote:fry-backup
filename_encryption = standard
password = xxxxx
password2 = xxxxx
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment