Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

How can I tail -f a file that over the network, say at \\192.168.2.130\public\print.log?

I have tried the variations of the following:

  • tail -f //192.168.2.130/Southpaw/Tactic/print.log which erred saying tail: cannot open `//192.168.2.130/Southpaw/Tactic/print.log' for reading: No such file or directory
  • Mounted the path using the mount -t cifs and then tried tail -f but that isn't working either, meaning it doesn't output the updates that are made to the file.
share|improve this question
2  
What about if you do this over ssh? ssh username@my.server.com "tail -f /var/log/example/print.log" Is it an option to you to ssh to the other server? Since cifs is not a "panacea" to all file sharing issues, i would not trust it to export logfiles that require updates on-the-fly. –  nwildner Dec 11 '13 at 13:14
    
@nwildner The other server hosting the file is not Linux, but Windows. And I'm lazy enough to open it's remote-shell ;). Plus that seems more of an overkill. –  Bleeding Fingers Dec 12 '13 at 7:16
    
Then, I would suggest you the same as @jofel answer: Use watch to reload the last X lines of the file: watch tail //192.168.2.130/Southpaw/Tactic/print.log . The default is 2s on the watch command, and it can be changed with the -n parameter. :) –  nwildner Dec 12 '13 at 10:46

3 Answers 3

This seems to be a bug in the cifs kernel module. It could be that it is fixed in a newer kernel version than you use. Try the directio mount parameter to circumvent the bug (this could lower the filesystem perfomance heavily).

Using watch tail print.log could also be an solution. It displays the 10 last lines of the file every 2 seconds.

share|improve this answer

Keep trying with mounted cifs. And just use tail with following parameter:

tail --retry --follow=name yourfile

Like this, tail follows the file name not the decriptor, and combined with --retry it tries again even if the file is inaccessible for some time.

share|improve this answer
    
Doesn't work. Not updating. –  Bleeding Fingers Dec 12 '13 at 7:36

The smb protocol is archaic with a bunch of added on extensions. It was not designed to handle your workflow, and no one has added support for it. either use a hack like the --follow=name in gnu tail or a different protocol. I would be inclined to do the tail on the server and use netcat for network transport, unless the server is windows, in which case I would do some testing, or try to find another server.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.