I have a series of scripts that are being killed (
$? says exit code is 137, which implies a
kill -9 scenario). I need to know what process killed them. Is there a way to find out this information?
I don't believe that there's any way to retrieve the pid of the process that sends the kill, at least from within another process. The signal is sent via a kernel interrupt, and as far as I know, it's only the kernel that knows which process sent it.
That being said, if you're comfortable with patching the kernel to find this out, you might take a look at this: patching the kernel to log signals
Exit code 137 references a time out signal.
I'd also suggest looking for the OOM issue in the /var/log/messages folder.