Version 3 of tclsvc - Tcl as an NT Service

Updated 2002-07-12 16:14:58

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 . -- CLN

As of version 1.1 (1999/6/28 in the source code $Id: 1797,v 1.4 2002-07-13 08:01:20 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 [But maybe only some flavors of Win* exhibit this?]

Category Package