LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices



Reply
 
Search this Thread
Old 09-11-2007, 03:45 AM   #1
ryanlum
Member
 
Registered: Jul 2007
Posts: 47

Rep: Reputation: 15
Need help with rsync


hey,

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?
 
Old 09-11-2007, 05:21 PM   #2
macemoneta
Senior Member
 
Registered: Jan 2005
Location: Manalapan, NJ
Distribution: Fedora x86 and x86_64, Debian PPC and ARM, Android
Posts: 4,593
Blog Entries: 2

Rep: Reputation: 328Reputation: 328Reputation: 328Reputation: 328
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?
 
Old 09-12-2007, 09:14 PM   #3
ryanlum
Member
 
Registered: Jul 2007
Posts: 47

Original Poster
Rep: Reputation: 15
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
 
Old 09-12-2007, 09:38 PM   #4
macemoneta
Senior Member
 
Registered: Jan 2005
Location: Manalapan, NJ
Distribution: Fedora x86 and x86_64, Debian PPC and ARM, Android
Posts: 4,593
Blog Entries: 2

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

Code:
rsync -av /some/source serverb:/some/destination/
RC=$?
if [ $RC -ne 0 ]
then
   mail -s "Error $RC on rsync" admin@host.net &>/dev/null
fi
 
Old 09-13-2007, 10:10 PM   #5
ryanlum
Member
 
Registered: Jul 2007
Posts: 47

Original Poster
Rep: Reputation: 15
hmmm...
may i ask what is /dev/null for?
i see it around alot.. but i don't get what is it used for
 
Old 09-13-2007, 10:27 PM   #6
macemoneta
Senior Member
 
Registered: Jan 2005
Location: Manalapan, NJ
Distribution: Fedora x86 and x86_64, Debian PPC and ARM, Android
Posts: 4,593
Blog Entries: 2

Rep: Reputation: 328Reputation: 328Reputation: 328Reputation: 328
'/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.
 
Old 09-16-2007, 10:51 PM   #7
ryanlum
Member
 
Registered: Jul 2007
Posts: 47

Original Poster
Rep: Reputation: 15
hmm i see i see
thx for the input
it was really helpful
 
  


Reply

Tags
rsync


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Rsync server vs rsync over ssh humbletech99 Linux - Networking 1 10-18-2006 01:10 PM
Rsync sant25 Linux - General 2 09-02-2005 04:34 PM
rsync $@ya Linux - Software 1 06-06-2005 12:45 PM
Windows Rsync Upload to Linux Rsync - permissions inspleak Linux - Software 0 10-12-2004 03:49 PM
Rsync Help! dlc2000 Linux - Software 2 06-16-2004 02:15 AM


All times are GMT -5. The time now is 04:14 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration