On Nov 8, 2004, at 2:52 PM, Tom Pollard wrote:
On Mon, 8 Nov 2004, Brendan Younger wrote:
I'm having problems getting SSH to quit automatically when the
command
it's executing exits. Specifically, this is what's going on,
1. my application runs a shell script
2. the shell script runs "ssh -q -f user@host command"
3. the shell script exits (ssh and the remote command are still
running)
4. my application exits (ssh session and remote command are still
running)
5. the remote command exits
6. ssh does NOT exit, but just stays open forever until I kill it
manually
How can I get ssh to exit? Running the "ssh -q -f user@host command"
incantation from the command line works as expected, ssh dies after
the
remote command does.
Try using
ssh -n -q -f user@host command
in your shell script. If you don't use '-n' to shut off stdin when
executing a backgrounded ssh command, ssh can hang. (See the ssh man
page).
Unfortunately, that didn't work. Anyone have any other ideas?