Knowledgebase
help needed on batch rsync
Posted by surfmanjoe, 09-03-2008, 09:55 PM | I want to write a script to do the following jobs at night:
1) mysqlhotcopy mysql databases to a backup folder (say local_folder) locally.
2) create a folder named by current date & time, like 20080908_0320am
3) rsync all local files under local_folder to 20080908_0320am on remote backup server
4) if any error exists, write a log file on remote backup server.
May I know it that possible for a linux novice to learn to write such a script in a short time (2-3 days)? Thanks.
|
Posted by ServerSurgeon George, 09-04-2008, 04:51 PM | This might help you:
www.tldp.org/LDP/abs/html/
|
Posted by Hostenlinea, 09-10-2008, 09:38 PM | You can program with few lines (with the apropiate rsync parameters) a .sh file that you could run from cron daily, for example:
In cron, something like this:
00 12 * * * /myscripts/backup.sh
And then create a bash script, for example:
$nano /myscripts/backup.sh
#!/bin/bash
date >> /var/log/file_back.log && /usr/bin/rsync -azvE 192.168.1.2::backup_dir /backup_files/server_bk && date >> /var/log/file_back.log
Basically this script send the actual time to log file, make the rsync and going to write date to file log. Then you can see the time starts and finish.
I´m not an expert in shell-programing but there are very information on net about scriptsmade by people and fully automated systems to make backups with rsync very easy.
Regards,
<>
Last edited by anon-e-mouse; 09-10-2008 at 09:54 PM.
|
|
Add to Favourites
Print this Article |
Also Read
Ezzi Down? (Views: 636)