Geek to live ! - A Research / Tech Blog
Monday, May 26, 2008
Backup your data periodically
REFERRED FROM : http://sushant354.blogspot.com/
Losing your computer data is a bad thing. One good habit is to regularly back up your data. But manually doing this is too cumbersome and so we need automated scripts to back up the data. Here is a small script that I use to back up my own desktop daily. It uses rsync protocol over ssh. You need to have ssh, rsync and ssh public-private key pairs for your back up machine. Setting up SSH key authentication is easy and here is one of the link http://www.ece.uci.edu/~chou/ssh-key.html
Add this script to your cron settings. For linux copy this file to /etc/cron.daily/ directory.
The benefit of using rsync is that only changes over the last week will be exported and it will save network bandwidth. SSH provides the encryption layer so that others cannot snoop on your data when you are backing up. This code is under Public Domain License. Customize it to your needs and auto back up your home directory from now onwards.
#!/usr/local/bin/bash
RSYNC=rsync
SSH=ssh
KEY=/home/sushant/.ssh/id_rsa
RUSER=sushant
RHOST=mybackupmachine.com
RPATH=backup/daily/`date +%u`
LPATH=/home/sushant/
$RSYNC -avxz --exclude=".*" --force --delete --delete-excluded --ignore-errors -e "$SSH -i $KEY" $LPATH $RUSER@$RHOST:$RPATH
No comments:
Post a Comment
Newer Post
Older Post
Home
Subscribe to:
Post Comments (Atom)
Blog Archive
►
2010
(2)
►
January
(2)
►
2009
(2)
►
August
(1)
►
February
(1)
▼
2008
(5)
►
December
(1)
►
October
(1)
▼
May
(3)
wireless cards supported on linux
Backup your data periodically
No title
►
2007
(6)
►
July
(1)
►
June
(2)
►
May
(3)
About Me
Rohith D V
View my complete profile
No comments:
Post a Comment