Skip to content

Instantly share code, notes, and snippets.

@toctan
Created May 31, 2013 05:39
Show Gist options
  • Save toctan/5683104 to your computer and use it in GitHub Desktop.
Save toctan/5683104 to your computer and use it in GitHub Desktop.
Full system backup with rsync.
#!/bin/sh
if [ $# -lt 1 ]; then
echo "No destination defined. Usage: $0 destination" >&2
exit 1
elif [ $# -gt 1 ]; then
echo "Too many arguments. Usage: $0 destination" >&2
exit 1
fi
START=$(date +%s)
rsync -aAXv /* $1 --exclude={/dev/*,/proc/*,/sys/*,/tmp/*,/run/*,/mnt/*,/media/*,/lost+found}
FINISH=$(date +%s)
echo "total time: $(( ($FINISH-$START) / 60 )) minutes, $(( ($FINISH-$START) % 60 )) seconds"
touch $1/"Backup from $(date '+%A, %d %B %Y, %T')"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment