Skip to content

Instantly share code, notes, and snippets.

@waitman
Created February 20, 2014 08:57
Show Gist options
  • Save waitman/9109538 to your computer and use it in GitHub Desktop.
Save waitman/9109538 to your computer and use it in GitHub Desktop.
#!/bin/bash
#create a backup of /etc using the date in the archive name.
#set schedule in cron
#example:
# 17 * * * * /backup-etc.sh
DATE=$(date +"%Y%m%d%H%M")
touch /var/opt/etc-backup-$DATE.tar.gz
chmod 600 /var/opt/etc-backup-$DATE.tar.gz
tar czfP /var/opt/etc-backup-$DATE.tar.gz /etc
tar tvf /var/opt/etc-backup-$DATE.tar.gz
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment