|   | ![[ Previous ]](navbprev.gif)  ![[ Contents ]](navbhome.gif)  ![[ Index ]](navbhelp.gif)  ![[ Next ]](navbnext.gif)  | 
Register a script to be run at server shutdown
ns_atshutdown {script | procname ?args?}
ns_atshutdown registers a Tcl script or procedure to be run when the virtual server shuts down.
    proc theLastThing {} {
    	global Shared
    	close $Shared(file)
    	ns_mutex destroy $Shared(lock)
    }
    
    ...
    ns_atshutdown theLastThing
    ...