I\'m using Paramiko to tail -f
a file on a remote server.
Previously, we were running this via ssh -t
, but that proved flaky, and the
I just hit this issue and wasn't in a position to issue a pkill to close the process at the end.
A better solution is to change the command you are running to:
tail -f /path/to/file & { read ; kill %1; }
This will let you run your tail command for as long as you need. As soon as you send a newline to the remote process the kill %1 will execute and stop the tail command you backgrounded. (for reference: %1 is a jobspec and used to describe the first process that has been backgrounded in your session, ie the tail command)