User Name Password Register
DaniWeb IT Discussion Community
All
What is DaniWeb IT Discussion Community?
You're currently browsing the Shell Scripting section within the Software Development category of DaniWeb, a massive community of 456,423 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 2,615 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our Shell Scripting advertiser: Programming Forums
Views: 2931 | Replies: 2
Reply
Join Date: Mar 2007
Posts: 1
Reputation: santhosheph is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
santhosheph santhosheph is offline Offline
Newbie Poster

Need a shell script for rsync

  #1  
Mar 2nd, 2007
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..

Thanks,
Santhosh
AddThis Social Bookmark Button
Reply With Quote  
Join Date: Jan 2007
Posts: 10
Reputation: kuom is an unknown quantity at this point 
Rep Power: 2
Solved Threads: 0
kuom kuom is offline Offline
Newbie Poster

Re: Need a shell script for rsync

  #2  
Mar 7th, 2007
Here's a quick one to get you started:

#!/bin/bash
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!" ;
else
    echo "no error occured, everything went fine!" ;
fi

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.

HTH

-Josh
Reply With Quote  
Join Date: Mar 2007
Posts: 1
Reputation: rggjan is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
rggjan rggjan is offline Offline
Newbie Poster

Re: Need a shell script for rsync

  #3  
Mar 10th, 2007
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!

Cheers
Jan
Reply With Quote  
Reply

Only community members can participate in forum threads. You must register or log in to contribute.

DaniWeb Shell Scripting Marketplace
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 

Thread Tools Display Modes

Similar Threads
Other Threads in the Shell Scripting Forum

All times are GMT -4. The time now is 1:07 am.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC