nigel@cmsfl@labtam.oz (Nigel Harwood) (07/13/90)
Folks, I have a strange problem which I hope someone can suggest some new approaches to solving. A bourne shell script is exiting prematurely. Once the script has run script1.sh it successfully writes to the log. Next is a test for an error log which usually does not exist. ABC does not appear in the log and script2.sh is not run. The exit status from the script is 0. This is happening once or twice out of 350 systems performing this function which is done once a day. It is my understanding that the only way for a script to prematurely end is by : i) doing an exit ii) doing an exec iii) a shell syntax error iv) receiving a kill signal I did not think that it was possible for a program or other script being invoked to cause the parent script to fail. If this is so then I should look through the other 4 alternatives. Can't be i) because an exit is not done. Can't be ii) because an exec is not done. Can't be iii) because I get an exit status of zero (or is this still a possibility ?). Can't be iv) for the same reason as iii). To add to all of this the script in question has not been recently changed. The only other thing I can think of is that the ERRLOG variable which is set to a literal value is somehow being corrupted and causing the script to have a syntax error. But even if this was the case I would still expect a non-zero return code. Help ? ------------------------------ LOG=abcde ERRLOG=fghij cprog1 if [ $? = 0 ]; then cprog2 if [ $? = 0 ]; then cprog3 script1.sh echo "XYZ" >> $LOG # This does appear in "abcde" if [ -s $ERRLOG ]; then cat $ERRLOG >> $LOG # This does not appear in "abcde" fi rm -f $ERRLOG fi fi echo "ABC" >> $LOG # This does not appear in the "abcde" script2.sh exit 0 ------------------------------ -- <<<<<<<<<<<<<<<<<<<<<<<<< Nigel Harwood >>>>>>>>>>>>>>>>>>>>>>>>>>> << Post: Coles Myer Ltd, PO Box 2000 Tooronga 3146, Australia >> << Phone: +61 3 829 6090 E-mail: nigel@cnw01.storesys.coles.oz.au >> <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>