Created
March 16, 2012 09:03
-
-
Save number23/2049228 to your computer and use it in GitHub Desktop.
linux system backup script
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
echo "SYSTEM Backup start at `date`!" | |
cd / | |
tar -czpf - --exclude=/proc \ | |
--exclude=/sys \ | |
--exclude=/mnt \ | |
--exclude=/media \ | |
--exclude=/dev \ | |
--exclude=/lost+found \ | |
--exclude=/home \ | |
--exclude=/opt \ | |
--exclude=/san \ | |
--exclude=/www \ | |
--exclude=/tmp \ | |
--exclude=/var/run \ | |
--exclude=/var/spool/cron/crontabs \ | |
--exclude=/root/.ssh \ | |
--exclude=/backup.tgz \ | |
--exclude=/etc/ssh \ | |
--exclude=/etc/network/interfaces \ | |
/ | ssh root@192.168.3.12 "cd /; tar -xzpvf -" | |
echo "SYSTEM Backup completed at `date`!" | |
echo "SAN RSYNC start at `date`!" | |
rsync -av -e ssh /san/ 192.168.3.12:/san/ | |
echo "SAN RSYNC Completed at `date`!" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment