I have a couple of programs which I execute on a remote host something like this:
ssh user@remotehost /path/to/command
It all works well, except when I kill the ssh session from the client end... the remote program continues to run until I log in and kill it.
What's weird is that Perl programs terminate ok - it's only my shell scripts which don't die. The code in the shell script is something like this:
Some header info
while true; do
echo "someoutput I got from somewhere"
I tried explicitly trapping various signals and using them to kill the script:
trap exit SIGHUP SIGQUIT SIGTERM
... but no cigar.
I get the same problem using plink
(another ssh implementation - part of the Putty suite). I tried various command line options to plink and ssh (disabling allocation of pty etc), but without success.
Anyone have any ideas?