Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I have been running some interactive shell scripts on a remote server.

Sometimes the ssh connection is lost, and I want the process on the other machine to die in such condition.

Can I configure the ssh connection to terminate remote process upon disconnection?

share|improve this question
add comment

1 Answer

up vote 1 down vote accepted

You need to set the ClientAliveInterval sshd configuration option to a non-zero value. Once the client fails to respond, the connection will be cut and the remote process will be sent a SIGHUP, stopping it (usually).

share|improve this answer
    
I cannot change the ssh configuration on the other part, just my parameters. –  Adam Matan Mar 5 '12 at 8:19
    
Well there's certainly nothing the client can do about it, seeing as how it's already disconnected... –  Ignacio Vazquez-Abrams Mar 5 '12 at 8:29
    
Isn't there any request that can be made by the client upon connection, asking for process termination upon disconnection? –  Adam Matan Mar 5 '12 at 8:49
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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