Is there a sig vector that fires when a process terminates normally? I'm working on a module that (among other things) writes to a log file. The first time it's called, it opens the log file, but how can you tell when it's the last time?
I'd like to do something like $SIG{'TERM'} = \&clean_up;. In fact, I did exactly that, but it didn't work.