How to stop a infinite running process(ztail) started by a ssh session after that session is closed

Posted by Sanath Adiga on Server Fault See other posts from Server Fault or by Sanath Adiga
Published on 2012-11-11T05:54:14Z Indexed on 2012/11/11 11:07 UTC
Read the original article Hit count: 427

I have a peculiar problem. My server supports multiple ssh session simultaneously, so that multiple admins can manage it simultaneously.

We have a command which calls ztail to show the compressed log files and when the current ssh session is closed (without pressing ctrlc, to stop the tail command), the command should ideally stop working.

But what I observed when I start a new ssh session is that the process ztail is still running in the background and consuming CPU, even though the previous session was closed.

How can I determine when the session is closed, so that I can use that variable/flag to close/stop any commands initiated by that previously closed session?

© Server Fault or respective owner

Related posts about linux

Related posts about linux-networking