Version 2 of tclsvc - Tcl as an NT Service

Updated 2001-09-25 11:30:11

It's possible to run Tcl scripts as services under Microsoft Windows NT. Matt Newman has done a nice job of producing a wrapper, ""tclsvc"", that lets any event-driven Tcl script run as a service. See it at http://www.sensus.org/tcl/index.htm . -- CLN

As of version 1.1 (1999/6/28 in the source code $Id: 1797,v 1.3 2002-06-21 03:30:16 jcw Exp $) there's a minor problem with this. The service only wakes up when the Tcl event loop fires. Hence, if you try to start or stop it from the services control panel and the Tcl code is blocked, the control panel will think the program has crashed. The simple solution is to put the following code before you start your main event loop:

 proc nothing {} {after 3000 nothing} ; nothing

This will wake the event loop every few seconds, which will allow Tclsrv to process requests for status, shut down, etc. -- DNew


Category Package