ns_atexit - Queue a script to run before server terminates
ns_atexit script ?arg?
This command queues a script to run right before the server terminates. The script and optional arg are concatenated together and added to the list of at-exit callbacks. The scripts are executed in the global scope in LIFO (last in, first out) order.