What I dislike about Fitnesse is running it from a bat file. In our situation, we have multiple administrators logging on to the server where Fitnesse resides. You get the point. When administrators log off, Fitnesse shuts down. While this post is geared towards using Fitnesse, we can apply similar procedures in order to make any bat file run as a windows service.
This post shows the steps I took recently to allow Fitnesse to run as a windows service. Our installation is running on Windows Server 2003. We need to install Windows Server 2003 Resource Kit Tools for this tutorial to work, as well as Fitnesse. Windows Server 2003 Resource Kit Tools can be used on XP as well. Search for other articles on its compatibility.
While reading articles on how to run a bat file as a service, I ran accross this one, Installing Fitnesse as a Service. It could not be any clearer than that. This solved my troubling issue. I do not want to reproduce this article, but I do want to add to it. Read this article first, and then mine. Many developers prefer screen shots to reading instructions. I will attempt to provide screen shots to improve points.
Originally, I started trying to get sample bat file to run as a service. I found a few articles helping me understand this, but they all lacked clarity. This is where I feel screen shots help. Eventually, I stumbled across the Fitnesse article I mentioned earlier, and success followed shortly thereafter.
Step One, install Windows Server 2003 Resource Kit Tools. We are going to create a user-defined service using two executables, Instsrv.exe and Svrany.exe. Instsrv.exe installs and removes services, and Svrany.exe allows any application to run as a service. Install the kit tools to their default. Keep track of where you installed them.
Step Two, register Fitnesse as a service. instsrv Fitnesse "C:\Program Files\Windows Resource Kits\Tools\srvany.exe" At this point, the service is now added.
These same principles can be applied to running a bat file as a windows service. My situation was specific to Fitnesse, but the same technique will apply to other applications.
Disclaimer The opinions expressed herein are my own personal opinions and do not represent my employer's view in any way.
© Copyright 2010 MuellerDesigns.net
Sign In