Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

error trap in ksh for 2 jobs running concurrently

Status
Not open for further replies.

pearlofperls

Technical User
Apr 5, 2007
24
US
2 java jobs being called in ksh script and error trapping wont work when one or both fails

Couple additonal points:
- this use to work on HP but doesnt after we migrated to solaris

- this type of error trapping works in solaris for other scripts calling one job

- we cannot make the jobs run serially, they need to run concurrently due to time restraints

e.g.

nohup $LIVE_DIR/ANVIL1 &

$LIVE_DIR/ANVIL2


wait

_ret_code=$?
if [ $_ret_code -ne 0 ]
then
echo "ANVIL Script failed."
exit $FAIL
fi
 
How about breaking it into two jobs, each with it's own error handling...
Code:
nohup $LIVE_DIR/ANVIL1.sh & 
nohup $LIVE_DIR/ANVIL2.sh &

Code:
$LIVE_DIR/ANVIL1

wait

_ret_code=$?
if [ $_ret_code -ne 0 ]
then
 echo "ANVIL1 Script failed."
 exit $FAIL
fi

Code:
$LIVE_DIR/ANVIL2

wait

_ret_code=$?
if [ $_ret_code -ne 0 ]
then
 echo "ANVIL2 Script failed."
 exit $FAIL
fi

Simple solution.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top