2
I have a log file on remote server, and I need to tail -f
it on local machine via ssh
. The command is pretty trivial:
ssh -n user@domain.com 'tail -f /path/to/remote/file'
Initially it works just great, but after some time (probably 1-3 hours) it stops working: there are new lines in the remote log file, but it isn't updated here, on local machine. No error is echoed, it just stops working. I have to interrupt it by pressing Ctrl+C and restart the same command, and it starts working again, for some time.
Internet connection is 100% working, because at the same time I have interactive SSH session to the same remote server, and it keeps working always.
What could be the problem, how to solve it?
Just in case, I'd say what I'm trying to achieve: it's just about remote irssi notifications. I have a server on which irssi is always running in tmux session, and I want to receive notifications on my desktop. So that important events (start_notification/stop_notification) are written to the log file, and my local script reads this log and manages notifications (tray icon, sound, libnotify's event)
And, as I already said, it stops working after some time, until I restart it.
My desktop OS is Linux Mint 13 MATE, server OS is Debian 3.2.51-1
Any help appreciated.
Thanks, I'll test it for some time to make sure, really hope it helps. But could you please elaborate on
TCPKeepAlive=no
? It sounds strangely, in case I want to keep connection alive :) – Dmitry Frank – 2014-02-22T18:53:37.440TCPKeepAlive does not always work and the default is yes (I think), instead of this mechanism we switch to a different system which actively asks every 15 seconds for a server reply to keep the connection alive. Maybe there is no need to disable the TCPKeepAlive but usually they do and there is no need for when you use ServerAliveInterval. – Requist – 2014-02-22T19:00:36.083