Hello Freinds,
I am in need of a shell script whiich rsyncs a folder from a server to my machine. My major concern is not a script that rysnc's but it should send a mail if the rsync failed for some reason while copying the files.. For example the remote server might go down in the middle of the copying or my machine can also be down.
How can i impliiment this? I hope i would get some help from you guys..

Looking for your updates..


Here's a quick one to get you started:

rsync -aze ssh username@server:/path/on/remote/box /local/path 2> /home/err.log
if [ -s /home/err.log ] ;  then
    # file is not empty, some error has occured, do your email here
    echo "error occured!" ;
    echo "no error occured, everything went fine!" ;

Obviously, you need to plug in the email portion...

I always throw in -z for rsync for the added compression benefit, and I also always use -e ssh to send it over SSH so it's encrypted.



Hi Santhosh

Did you find something? If not... I got a project running which does exactly what you need. Have a look at smarbs.sourceforge.net.

I'd be glad if you'd tell me if it worked for you!


Be a part of the DaniWeb community

We're a friendly, industry-focused community of 1.21 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.