in reply to How to trace a dying process

It depends on how the script dies. If it's getting some sort of signal, then it'd be as easy as setting up %SIG. If it's dying "mysteriously," I'd pepper some print statements here and there and go from there.