-   Linux - General (
-   -   Need help with rsync (

ryanlum 09-11-2007 03:45 AM

Need help with rsync

I have this issue where i have to monitor a folder for rsync.. if rsync stops sending within a certain time frame, i have to generate a file..

whats the best method to use for this type of method?

macemoneta 09-11-2007 05:21 PM

Try to be more specific. What do you mean when you say "monitor a folder for rsync"? Are you looking at the sending or the receiving side? What criteria defines a problem situation?

Rsync has it's own error detection, and will exit with an error. Why wouldn't you just check for a non-zero return code from rsync and take corrective action?

ryanlum 09-12-2007 09:14 PM

hmm.... this is how it goes...
i got 2 servers A (rsync) n B

server a will pump files to server B. here is what i wanna do..

in server b.. a script to monitor folder, to check whether server b is receiving files from rsync regularly within a 5 min interval.. if it is not... then it will pump an error log out

macemoneta 09-12-2007 09:38 PM

That's backwards. You want to check server 'A' in your example for a transmission problem. For example:


rsync -av /some/source serverb:/some/destination/
if [ $RC -ne 0 ]
  mail -s "Error $RC on rsync" &>/dev/null

ryanlum 09-13-2007 10:10 PM

may i ask what is /dev/null for?
i see it around alot.. but i don't get what is it used for

macemoneta 09-13-2007 10:27 PM

'/dev/null' is the bit bucket; anything written to it is discarded. In the above example, any messages written by the mail command are discarded by sending them to /dev/null.

The reason is that there is no email body included in the above example (just a subject). When used this way, the mail command will generate the message "No email body, I hope that's OK". Redirecting all output to /dev/null suppresses this message.

ryanlum 09-16-2007 10:51 PM

hmm i see i see
thx for the input
it was really helpful

All times are GMT -5. The time now is 04:10 AM.