Operating System - HP-UX
1831336 Members
3101 Online
110024 Solutions
New Discussion

Re: New problem with a script well used and tested script....

 
SOLVED
Go to solution
Joanne Keegan
Regular Advisor

New problem with a script well used and tested script....

I have an unusual problem with a script that hasn't been modified (I checked it against one that was restored), yet it hangs at a certain point. This problem started only a few days ago.

The script involved is initiated from another one that shuts down Omniback. That part goes okay. The script with the problem hangs. The code is:


#!/bin/sh
sleep 2
if [ -f /var/adm/logs/OBII_split.*`date "+%d"`]
then
if [ ! -f /var/adm/logs/OBII_split.`date "+%y%m%d"` ]
then
/usr/bin/rm /var/adm/logs/OBII_split.*`date "+%d"`
fi
fi

##############

It doesn't seem to get past this point, as the next line in the script creates a log file, and this doesn't occur.

We haven't run out of disk space. Set -x doesn't provide anything meaningful. No new patches have been loaded for a couple of months.

I deleted those lines of code out of the script, it then ran fine.

Why has this happened? The script definitely has changed, and has been working well for years. Is there a process limit or something similar I should be looking at? Any suggestions of what to look at next would be appreciated.

Incase this info helps, we are running HP/UX 11.0 on a K460.

Regards,

Jo
7 REPLIES 7
Joanne Keegan
Regular Advisor

Re: New problem with a script well used and tested script....

I just reread what I submitted. I made a typo at the end - the script definitely hasn't been changed.

By the way we are running OBII 3.1.

Thanks,

Jo
Patrick Wallek
Honored Contributor

Re: New problem with a script well used and tested script....

What happens if you add a couple of comments in your script, so it looks like:

if ..............
then
echo "First if statement"
if ..........
then
echo "Second if statement"
rm ........
fi
fi

Does it display either echo phrase?
A. Clay Stephenson
Acclaimed Contributor

Re: New problem with a script well used and tested script....

Hi Joanne:

My best guess (and it's only that at this point) is that the rm is hanging because of a corrupt filesystem/directory/directory entry.
I suggest that you put an echo before the remove and then try to remove the files manually. I think the rm will hang again and you will know the trouble maker file.

Happy hunting, Clay
If it ain't broke, I can fix that.
John Poff
Honored Contributor
Solution

Re: New problem with a script well used and tested script....

In addition to the other suggestions, I would try putting an echo statement in the script that calls this one, just before the exit point. Possibly the calling script is blowing up for some strange reason?

Also, to follow up on Clay's point, have you seen any strange messages in syslog when this script runs?

JP
Joanne Keegan
Regular Advisor

Re: New problem with a script well used and tested script....

Thanks to all that replied.

I now have things working again. The problem was with the first script and it was hanging when trying to call the second one. I've changed the way of calling the second script and all is fine.

Question is - why did it stop working - especially when the script(s) haven't changed?

Regards,

Jo
A. Clay Stephenson
Acclaimed Contributor

Re: New problem with a script well used and tested script....

Hi Joanne,

I feel like we're missing a piece of the puzzle. Generally, a script hangs when it is waiting for input. I'm not sure that we are dealing with a hang or an abort. What was the change you made? Perhaps that might give us a clue. Are you by any chance using remsh?

Clay
If it ain't broke, I can fix that.
John Poff
Honored Contributor

Re: New problem with a script well used and tested script....

Hello Joanne,

I'm glad you got your script working!

As for the cause, something must have changed somewhere. I've run into strange problems like that before, and I have even resorted to using a find command on the whole system to find any recently modified files. Any of the binary executables changed that the scripts call? Has the kernel had a parameter change and been relinked?

There are so many things that can change, it can be tough to figure it out sometimes. If this is the only problem you have, I wouldn't worry about it too much. But if you keep seeing other things break that haven't changed, you might have to do some detective work.

Have fun!

JP