http://qs321.pair.com?node_id=700928


in reply to Re^2: print on reboot or process shutdown
in thread print on reboot or process shutdown

If you only have one normal exit point to your script, have it set a flag. Check this flag in your END block, and only write to the file when it is not set.

If you have more than one normal exit point to your script, well, refactor a bit. :-)

PS: note that the way you're opening your file, its contents will be overwritten every time, rather than appended to. Use ">>" if you prefer the other way.