Updated at July 17, 2026 02:08 PM
box.ctl.on_shutdown()
Create a "shutdown trigger". The trigger-function will
be executed whenever os.exit() happens, or when the server is
shut down after receiving a SIGTERM or SIGINT or SIGHUP signal (but not
after SIGSEGV or SIGABORT or any signal that causes immediate program
termination).
Parameters:
-
trigger-function(function) — function which will become the trigger function -
old-trigger-function(function) — existing trigger function which will be replaced by trigger-function
Returns
nil or function pointer
If the parameters are (nil, old-trigger-function), then the old trigger is deleted.
If you want to set a timeout for this trigger, use the set_on_shutdown_timeout function.