What we do is back up daily only changed files to a local drive.
Then use this script to ssh the files to a the remote server:
Code:
You may want to change "scp -r" to "scp -rpq".. That will preserve permissions/timestamps and also prevent output of the progress meter.
Follow the steps as given below:
1.SSH the server on which you want to setup the cron job.
2.cd /usr/bin
3.Create a file scpe.sh
4.Copy the contents between the below lines to scpe.sh
==========
#!/usr/bin/expect -f
set root_pass "xxxxxxxxxxx"
set hostname "123.45.678.910"
set folder "/backup/cpbackup/daily"
spawn /usr/bin/scp -r $folder root@$hostname:/backup/
sleep 3
expect "password: "
sleep 3
send "$root_pass\r"
interact
===========
6.chmod 755 scpe.sh.
5.Setup a daily cronjob which calls the script. (ie. a file in cron.daily named backup.cron and containing the command:
/usr/bin/scpe.sh )
Note : REPLACE THE IP AND PASSWD IN THE SCRIPT WITH THE IP AND PASSWD AS THAT OF THE REMOTE SERVER.
The script will copy the entire folder daily to the remote server's /backup/
partition, and put it into a directory named daily.
The problem is this overwrites files that have not changed.
If it would just do a rcync method and only change new files it will be near perfect.
Any thought on how to add to this code to only have changed files be transfered to the remote folder?
The the ssh is good because it encrypts the data when being transfered in case of sniffers.