How can I make a command sent through ssh die if the ssh connection is killed?
- by Jean-Francois Chevrette
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?