Skip to content

Instantly share code, notes, and snippets.

@number23
Created March 16, 2012 09:03
Show Gist options
  • Save number23/2049228 to your computer and use it in GitHub Desktop.
Save number23/2049228 to your computer and use it in GitHub Desktop.
linux system backup script
#!/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