How do I kill a remote login session as well as processes started inside it?
Issue
- How do I
killa remote login session as well as processes started inside it? - If the user terminates the SSH session by hitting the X button, it leaves the
scriptprocesses running. - How can I configure the
.profileto clean up (kill) the processes if the user terminates the SSH session? - We have added below script inside
.profilewhich is not working:
set -x
PATH=$PATH:$HOME/bin
export PATH
trap "kill -15 0; exit" EXIT INT HUP
scriptname
kill -15 0
Environment
- Red Hat Enterprise Linux 6.X
- util-linux
- ssh
Subscriber exclusive content
A Red Hat subscription provides unlimited access to our knowledgebase of over 48,000 articles and solutions.
Welcome! Check out the Getting Started with Red Hat page for quick tours and guides for common tasks.
