|P is for Practical|
yet another thread/signal questionby markseger (Beadle)
|on Nov 06, 2011 at 14:14 UTC||Need Help??|
markseger has asked for the
wisdom of the Perl Monks concerning the following question:
I'm trying to ssh to multiple nodes in parallel via threads and it seems to work just fine. Only problem is when a node doesn't support passwordless ssh things go south.
My solution is to simply wait awhile in a loop, and if the ssh fails kill the thread. I read previous notes about setting up a signal handler in the thread and I tried that and it seems to work just fine. The reason I know this is I have a 'print' in the signal handler and I do see the results. Only problem was when the script eventually exits, it reports:
and I'm not sure what to do. What I did do was write a pretty small script that starts the thread, gives it a few seconds to run, and if the ssh doesn't finish and set a flag, it kills the thread. Only thing is now my signal isn't even firing! So now this is turning into a 2-part question:
- why doesn't the signal fire in the thread and
- if it does fire, how do I get rid of the 'unjoined' message at the end?
note - if I use a valid user/hostname the script runs just fine and exits cleanly.
what is happening now is I see the echo of the password prompt to the ssh and then nothing! If I remove the join, I see the 'kill signal sent' message but then it just hangs.
gotta be something simple but I'm just not seeing it.