1834508 Members
2303 Online
110068 Solutions
New Discussion

Weird random script hang

 
Jeff_Traigle
Honored Contributor

Weird random script hang

Ok... I'm puzzled. The following script worked fine for me during testing. It hung when a coworker tested it, but, when we ran through it again and another system, it worked. Everything appeared to work properly on the system it hung on too, other than it not exiting. We ran a couple of pilots to customers and one of them experienced the same hanging symptom. They re-ran it and it finished without incident the second time. I'm baffled (either because some systems are just being flaky or I'm totally missing something.) Anyone see anything syntactically that would cause this?
--
Jeff Traigle
5 REPLIES 5
Todd McDaniel_1
Honored Contributor

Re: Weird random script hang

First of all, what system did you initially test it on? and was the other SA testing it on a similar server?

Did you run it as root? or as a user?

Are the OSs the same on each of the servers?

Where does it hang? when it is trying to assess the ttys?



----------------------------------------------------
It might be more elegant to use a CASE structure instead of sooo many if/then/else statements...

Seems like a rework is in order.

Unix, the other white meat.
Jeff_Traigle
Honored Contributor

Re: Weird random script hang


Same hardware (all rp2430s)... all at Rel_B.11.00 with same patches.

Definitely run as root. (Script would exit immediately since that's the first thing I check.)

It appears to hang at the very end from what she could tell. I have yet to witness a failure during all the time I was testing during development. According to her, all of the logs indicated it had done everything it was supposed to do... other than it just hung at the very end before exiting and the system didn't reboot.

As for so many if/then/else statements vs. case statements, I don't think it matters much. Nearly all of the if statements are error checking so it would be at least as ugly with "case"s. (Or maybe I just know how to be elegant. :)
--
Jeff Traigle
Todd McDaniel_1
Honored Contributor

Re: Weird random script hang

elegant = easier to decipher for errors

Elegant may be an overstatement, but CASE statements definintely help imho...


My thought is this about scripting...

1) make them easy to read
2) make them Modular so they can be updated easily
3) Document to help understand what you are doing...6 months later when you cant remember what it was supposed to do. :D


I might rewrite it with a command script which calls "modules" so you can troubleshoot easier...

Or as you probably have done add echo statements to track where the script is and what it is doing at the moment.
Unix, the other white meat.
Floyd Curtis
Frequent Advisor

Re: Weird random script hang

Might try putting set -x to debug it to see where it hangs.
See
http://docs.hp.com/hpux/onlinedocs/B2355-90046/00/01/117-con.html
good luck

fwc
Mark Grant
Honored Contributor

Re: Weird random script hang

I agree with Floyd about putting a set -x in your script.

However, if I were to make a bet, it would be that it is hanging here

/usr/sbin/diag/contrib/pdcinfo

I wouldn't put too much money on it though.
Never preceed any demonstration with anything more predictive than "watch this"