<Documentation is a work in progress>
This is a generic binary that allows any long-lived Tcl program (i.e. event loop oriented) to run as a true NT Service.
Copy the tclsvc80.exe to your main Tcl installation bin directory, and rename to the shortname you wish to use for your service (e.g. myapp.exe). The short name is used when issuing the "net start" or "net stop" commands to start and stop your service.
Run myapp with install option (it is important that this executable run is in the final location it will be run from in a live situation). E.g.
myapp.exe -install "My First Tcl Service"
Then add the following to the registry: -
Key: HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\myapp
Value: TclScript, set to "source c:/my/dir/where/my/script/is/myscript.tcl"
Change your server script from :
...
vwait foreever
to
...
if {![info exists tcl_service]} {
vwait forever
}
NOTE: it is very important that the script finish execution - the service will manage the Tcl event loop on behalf of the application.
Errors during startup will be placed in the Application Event Log, under the service short-name (myapp).
Matt Newman