How can I make a command sent through ssh die if the ssh connection is killed?
Posted
by Jean-Francois Chevrette
on Server Fault
See other posts from Server Fault
or by Jean-Francois Chevrette
Published on 2010-03-10T16:13:36Z
Indexed on
2010/03/11
17:20 UTC
Read the original article
Hit count: 422
When using SSH to send a command to a remote server, if the SSH connection dies the process keeps running. Are there any ways to have it kill the child processes if the SSH connection ends?
Example:
root@local:~# ssh root@server sleep 100 &
[2] 15762
root@local:~# kill 15762
[2]+ Stopped ssh root@server sleep 100
After running the above, the sleep command is still running on the remote host.
Any ideas?
© Server Fault or respective owner