AIX-ksh script ends unexpectedly

Hi,

I have a ksh script running on AIX 5.3 which has sometimes a bizarre behaviour.
The script runs a child script like follow.

trap 'rm -f /tmp/res.log;exit 0' 2 15
run_child.sh > /tmp/res.log 2>&1
echo "run_child.sh is terminated"
next instructions...
rm -f /tmp/res.log

sometimes, the echo and next instructions are never proceeded.
if you set -x the script, you can see the last instruction is

+ run_child.sh > /tmp/res.log 2>&1

if you trace run_child.sh, you can see that it seems to go fine as i put an echo just before his last instruction (exit 0), and that i can see the result of the echo in the log.

So I'm searching here because i don't know what happen really.
This is not systematic but arrives sometimes (10% of executions)

any ideas ?

If you didn't have the exit 0 in the trap, I think it will continue.
Try looking at this - Unix - Signals and Traps

I'm sure that it do not enter in the trap as file is not removed.
If it enters in the trap, the exit is normal after removing the tmp file.

How is the calling script being run? Is it on a terminal connection which might timeout or break?

No, this is batch mode, there is no timemout, child is being proceeded in less than 2 seconds before problem arrives.

How is the parent script being run?
What is in the child script?

Parent script is run with HP Operation Manager with root user and a process named opcle
Child script is collecting information in a Oracle database and then ends with an output file.

Have you tried your support agency or the HP ITRC. Imho this needs a HP OpenView expert.

i can try but this is not an HP script so not sure it will be helpful.

What is in the run_child.sh script ?

This is a simple collect of data in an oracle database.
This runs normally even if the problem occurs.

Long shot: Have you checked for core dumps ?

Also, if this script is running as a non-root user you might be hitting kernel limits.

No core dumps.
The script is run with root permissions.