How to make ssh to kill remote process when I interrupt ssh itself?

In a bash script I execute a command on a remote machine through ssh. If user breaks the script by pressing Ctrl+C it only stops the script - not even ssh client. Moreover even if I kill ssh client the remote command is still running...

How can make bash to kill local ssh client and remote command invocation on Crtl+c?

A simple script:

#/bin/bash
ssh -n -x root@db-host 'mysqldump db' -r file.sql

Answers


Eventual I found a solution like that:

#/bin/bash
ssh -t -x root@db-host 'mysqldump db' -r file.sql

So - I use '-t' instead of '-n'. Removing '-n', or using different user than root does not help.


Need Your Help

Reverting the Load statement of Impala?

hadoop cloudera impala

I have created a table on Impala and loaded data into table.

I want to develop an iPhone app using AIR and ActionScript 3 and I need the app to receive MIDI. How?

ios actionscript-3 air coremidi

I am not entirely sure of how these associations work. iOS implements CoreMIDI. Ok. It's possible to build an app with CoreMIDI support with XCode and objective C. I don't own a Mac and I am absolu...

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.