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?


You don't say what is the command that you run in your ssh session and in turn invokes ztail, nor whether this command keeps running or not.

When you close the session, that command receives a SIGHUP signal, and should then dispose of ztail.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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