Unix/Linux Go Back    


Shell Programming and Scripting BSD, Linux, and UNIX shell scripting — Post awk, bash, csh, ksh, perl, php, python, sed, sh, shell scripts, and other shell scripting languages questions here.

Tail over rsync data

Shell Programming and Scripting


Tags
rsync, tail -f

Closed    
 
Thread Tools Search this Thread Display Modes
    #1  
Old Unix and Linux 08-13-2013   -   Original Discussion by rish_max
rish_max's Unix or Linux Image
rish_max rish_max is offline
Registered User
 
Join Date: Feb 2009
Last Activity: 15 June 2017, 12:16 PM EDT
Posts: 12
Thanks: 0
Thanked 0 Times in 0 Posts
Tail over rsync data

Hi,
I have written a shell script (that will be called in every 5 seconds) that used rsync to copy logs of our production server from server A(production) to server B (Dev), because we don't allow team members to hit server A.
The shell script is working fine.
But we are facing a problem that command "tail -f <log file name>" on server B is not printing current logs.
But if we continuously re-open it in vi editor we have noticed changes.
Please tell the way how to do that ?
Thanks
Sponsored Links
    #2  
Old Unix and Linux 08-13-2013   -   Original Discussion by rish_max
Jotne's Unix or Linux Image
Jotne Jotne is offline
Registered User
 
Join Date: Dec 2010
Last Activity: 20 September 2014, 2:08 AM EDT
Posts: 1,040
Thanks: 62
Thanked 213 Times in 203 Posts
I guess that it gets a new file every 5 seconds, and tail -f only follow old file that no more exists.
Try this instead:
tail --follow=name /var/log/yourlogfile

This make tail follow the name of the file, and have no problem when file is overwritten etc
Sponsored Links
    #3  
Old Unix and Linux 08-13-2013   -   Original Discussion by rish_max
rish_max's Unix or Linux Image
rish_max rish_max is offline
Registered User
 
Join Date: Feb 2009
Last Activity: 15 June 2017, 12:16 PM EDT
Posts: 12
Thanks: 0
Thanked 0 Times in 0 Posts
Hi Jotne,
Thanks for the quick reply. I have used the command, but it is reading and display all contents of the given file. I only need the difference (delta) of the two files.
Sponsored Links
Closed

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Linux More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Joining multiple files tail on tail kayak Shell Programming and Scripting 2 10-02-2012 06:36 AM
Extract data based on match against one column data from a long list data patrick87 Shell Programming and Scripting 12 11-17-2009 04:27 AM
rsync data corruption thameema UNIX for Advanced & Expert Users 1 05-19-2009 09:23 AM
Tail?? qfwfq Shell Programming and Scripting 7 06-19-2006 02:15 AM
using tail -f cdunavent Shell Programming and Scripting 6 10-23-2002 06:10 PM



All times are GMT -4. The time now is 05:46 AM.