Skip to content

Instantly share code, notes, and snippets.

@coaxial
Last active October 30, 2016 20:26
Show Gist options
  • Save coaxial/06aa9e665bfbb791ad7e1409fa5d2d17 to your computer and use it in GitHub Desktop.
Save coaxial/06aa9e665bfbb791ad7e1409fa5d2d17 to your computer and use it in GitHub Desktop.
quick bash script to make system backups
#!/usr/bin/env bash
# tar -zcpf /mnt/storage/backups/`date "+%Y%m%d_%H%M%S"`_`hostname`.tar.gz --directory=/ --exclude=proc --exclude=sys --exclude=dev/pts --exclude=media --exclude=srv --exclude=mnt .
tar -jcpf /mnt/storage/backups/"$(date "+%Y%m%d_%H%M%S")"_"$(hostname)".tar.bz2 --one-file-system /
# Sample cron entry to run sysbackup every day at 4:52am, assuming this script is executable in /usr/bin/
# 52 4 * * * sysbackup
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment