Created
July 20, 2016 23:06
-
-
Save dungam/2ffe7c6161c3a244efd71fc110b6bd6a to your computer and use it in GitHub Desktop.
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/bash | |
## -------------- | |
## Important notes | |
## | |
## * Run script as root or sudo | |
## * home.server is defined in ~/.ssh/config. Sample ~/.ssh/config is attached. | |
## * modify /etc/hosts to map home.server to correct IP address on your network | |
## | |
## * create an exclusion-list.txt file make sure the scripts point to its location correctly | |
## * script tested on Linux Mint | |
##---------------- | |
# // see if home.server is available | |
echo -e "\n\n\t Testing if remote host is available. Please wait ..." | |
nc -z home.server 22 > /dev/null | |
if [ $? -ne 0 ]; then | |
echo "\n\n\t Operation aborted!\n\t Remote PC 'home.server' is not available at the moment \n\n" | |
exit $? | |
fi | |
# // copy files from local pc to home server | |
rsync -avP --exclude-from '/home/dunga/scripts/exclusion-list.txt' /home/dunga/scripts/ home.server:/home/dunga/scripts/ | |
rsync -avP --exclude-from '/home/dunga/scripts/exclusion-list.txt' /home/dunga/dev/ home.server:/home/dunga/dev/ | |
rsync -avP --exclude-from '/home/dunga/scripts/exclusion-list.txt' /home/dunga/Documents/data/ home.server:/home/dunga/data/ | |
rsync -avP --exclude-from '/home/dunga/scripts/exclusion-list.txt' /home/dunga/Documents/misc home.server:/home/dunga/data/work | |
rsync -avP --exclude-from '/home/dunga/scripts/exclusion-list.txt' /home/dunga/Documents/.homebank home.server:/home/dunga/data/work | |
# // backup the whole system | |
rsync -aAXv --exclude={"/dev/","/proc/","/sys/","/tmp/","/run/","/mnt/","/media/","/lost+found","/home/"} /* home.server:/media/dunga/big_hdd/dunga/backup/pc01 |
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
protocol 2 | |
## contents of | |
## ~/.ssh/config | |
Host home.server | |
Hostname 192.168.1.20 | |
# Hostname example.com | |
# GSSAPIAuthentication no | |
User dunga | |
Port 22 | |
IdentityFile ~/.ssh/id_rsa.pub |
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
/media/ | |
/dev/ | |
/proc/ | |
/sys/ | |
/usr/ | |
/srv/ | |
/tmp/ | |
/run/ | |
/mnt/ | |
/build/ | |
/cdrom/ | |
/lib/ | |
/lib64/ | |
/root/ | |
/opt/ | |
/sbin/ | |
/home/ | |
/lost+found | |
/home/*/.cache/ | |
/home/*/.local/share/Trash/ | |
/home/*/.gvfs/ | |
/home/*/.aptitude/ | |
/home/*/.bluefish/ | |
/home/*/.cache/ | |
/home/*/.dbus/ | |
/home/*/.giteye/ | |
/home/*/.gnome/ | |
/home/*/.gnome2/ | |
/home/*/.gnome2_private/ | |
/home/*/.gnupg/ | |
/home/*/.gstreamer-0.10/ | |
/home/*/.hardinfo/ | |
/home/*/.icons/ | |
/home/*/.java/ | |
/home/*/.kde/ | |
/home/*/.lastpass/ | |
/home/*/.linuxmint/ | |
/home/*/.local/ | |
/home/*/.macromedia/ | |
/home/*/.mplayer/ | |
/home/*/.mysql/ | |
/home/*/.pki/ | |
/home/*/.subversion/ | |
/home/*/.thumbnails/ | |
/home/*/.vagrant.d/ | |
/home/*/backup/ | |
/home/dunga/Downloads | |
/home/dunga/isomnt | |
/home/dunga/Calibre\ Library/* | |
/home/dunga/tmp | |
/home/dunga/VirtualBox\ VMs | |
/home/dunga/.VirtualBox | |
/home/dunga/.thumbnails | |
~/.ssh/authorized_keys | |
~/.ssh/id_rsa | |
~/.ssh/id_rsa.pub | |
~/.ssh/known_hosts |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment