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?