You might want to look at other Signals as well and capturing those as well. DIE comes to mind at the moment but you can dig up a list of different Signals from Unix man pages (I think kill might list them out but I can't recall at the moment). I haven't played around with capturing signals apart from DIE so your mileage may vary. Some signals you might not be able to capture. For example, I doubt you'd be able to write to a file is someone has yanked the power cord from a server.