I recently wrote a script that waits for something to happen and then executes a command on a remote machine via ssh. I ran into a problem where the ssh connection was established and then the ssh connection would never close.
I found out after some diagnostics that becuase there was no tty assigned to the local session that a tty was not being assigned on the remote session and for some reason ssh was not disconnecting after the command had finished.
The solution was to run the ssh command with the -t flag as such:
ssh -t -t user@example.org "somecommand"
The -t is used to force pseudo-tty allocation but when there is no local tty you must use -t -t to force tty allocation on the remote server.
About Matt
IF YOU REALLY want to hear about it, the first thing you'll probably want to know is where I was born, and what my lousy childhood was like, and how my parents were occupied and all before they had me, and all that David Copperfield kind of crap, but I don't feel like going into it, if you want to know the truth.
In any case I am employed as a Senior Linux Systems Engineer at Rackspace in San Antonio, TX.
I spent the majority of my college years as an Astrophysics major specializing in black holes. When I got to my senior year and was studying 40 hours a week to stay on track I decided to bail and pursue an easier career.
I spend the majority of my time now contributing to WordPress, developing WordPress plugins, helping out in the WordPress IRC Channel, playing football (not American!), practicing Krav Maga, and last but not least, spending time with my Wife and Son.