3.7.34. ShutdownHook Previous topic Parent topic Child topic Next topic

This optional parameter allows you to define a Perl function that will be called just before exiting after receiving a SIGTERM. No arguments are passed.
The hook code is compiled by Perl when Radiator starts up. Compilation errors in your hook code will be reported to the log file at start-up time. Runtime errors in your hook will also be reported to the log file when your hook executes. Multiline hooks (i.e. with trailing backslashes (\)) are parsed by Radiator into one long line. Therefore you should not use trailing comments in your hook.
ShutdownHook can be an arbitrarily complicated Perl function, that might run external processes, consult databases, change or set up environment variables, umasks etc.
# Delete a lock file
ShutdownHook sub { unlink '/tmp/xyzzy.lck';}