Skip to content

Instantly share code, notes, and snippets.

@topu
Created January 17, 2015 10:45
Show Gist options
  • Save topu/00464e0a377efad8b978 to your computer and use it in GitHub Desktop.
Save topu/00464e0a377efad8b978 to your computer and use it in GitHub Desktop.
#!/bin/sh
#TODO rsync over ssh
#TODO lvm snapshots
#TODO mounting external encrypted drive
#TODO rotating backups
#TODO initial backup (no 'current' link)
readonly PATHTOBACKUP=/mnt/backup
backup_local() {
local name=$1; shift
local sources=$@
local destination=$PATHTOBACKUP/$name
local date=`date "+%Y-%m-%dT%H:%M:%S"`
rsync -aAXHS -v -x -R --numeric-ids --link-dest=$destination/current $sources $destination/back-$date
rm $destination/current && ln -s back-$date $destination/current
}
main() {
backup_local vostro / /boot /boot/efi
}
main
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment