How do you start an IBM Rational DOORS Web Access as a Microsoft Windows service?
IBM Rational DOORS Web Access is generally started manually on Microsoft Windows and the user who starts it needs to remain logged in for the process to continue running.
It is possible, using Microsoft tools, to create a Microsoft Windows service that starts the IBM Rational DOORS Web Access (DWA) processes.
The steps described below are unsupported by IBM Rational and are provided on as "AS IS" basis.
Note: The process below will require Windows Registry edits. If you would rather not modify the Windows registry as described below, but still want to automate DWA startup, you may be interested in Core Technologies Consulting, LLC's AlwaysUp product. Please note that this is a third-party product which is not supported or endorsed by IBM.
These steps require the following applications, which are part of the Microsoft Windows 2003 Resource Kit (which also works on Microsoft Windows XP)
Note: Download the Microsoft Windows 2003 Resource Kit. Note that for Windows Server 2008, there is no equivalent of the Microsoft Windows 2003 Resource Kit. One way to work around this would be to copy the files from the Microsoft Windows 2003 Resource Kit onto the Windows 2008 server system and then set up the services -- once again, this a custom, unsupported process.
These tools allow you to create a Microsoft Windows user-defined service.
For best results, write a script to start (and stop) DOORS Web Access. This will automate the individual steps in the correct order. Creating a script that starts DOORS Web Access allows you to create a single Microsoft Windows service to start DOORS Web Access.
To write the .bat file for each script, put the commands in the correct order. Feel free to use variables/parameters to make the script more flexible/portable. You may want to create a special user to run the DWA start/stop scripts, so it is easy to spot which processes belong to DWA when using the Windows Task Manager.
A typical Windows DOORS Web Access start script would:
- Start the DWA broker as instructed in the DOORS Web Access install guide.
- Wait for the DWA broker to start.
- Start the Interoperation server process by running doors.exe with the -interop flag as instructed in the DOORS Web Access install guide.
- Wait for the Interoperation server to start.
- Start the DWA server as instructed in the DOORS Web Access install guide.
A typical Windows DOORS Web Access stop script would:
- Stop the DWA server as instructed in the DOORS Web Access install guide.
- Wait for the DWA server to stop.
- Stop the Interoperation server process.
- Wait for the Interoperation broker to stop.
- Stop the DWA broker as instructed in the DOORS Web Access install guide.
Here are two ways to make a DOS script wait:
- Use the sleep command, courtesy of Windows 2003 Resource kit:
- If you don't want to get the sleep command, you can emulate sleep using this ping workaround:
PING <invalid_host> -n 1 -w <time_in_ms> >NUL
-n 1 ==> send one echo request
-w ==> time (in ms) to wait before timing out
Using ping like this with an invalid host will result in a pause for the specified time, emulating sleep.
Example that times out in 30 sec.:
PING 188.8.131.52 -n 1 -w 30000 >NUL
Depending on your environment, several different techniques can be used to stop the Interoperation server process:
- If you run the DWA scripts manually, you can stop the Interoperation server process manually. In the DWA stop script, set up a pause command so the script waits for you to manually kill the Interoperation server process. For example:
REM stop the Interoperation server process
echo Kill the Interoperation server (close its cmd window) then press Enter
- If you start DWA automatically but still stop DWA by manually running the DWA stop script, you can manually kill the Interoperation server process via the Windows Task Manager, by killing its doors.exe process. This is where having a dedicated DWA user to run the scripts comes in handy, as it makes the Interoperation server process doors.exe process much easier to find. In this case, you can use the code from option #1 with minor changes to the echo command.
- If you need a fully automated solution, you will need a command that finds and kills the Interoperation server process in your DWA stop script. One way to do this is with the Windows TASKKILL command (type "TASKKILL /?" from a DOS window for syntax/details). The following example (forcibly) kills all doors.exe processes (including children) started by dwa_user:
TASKKILL /FI "USERNAME eq dwa_user" /IM doors.exe /F /T
This solution contains information about modifying the system registry. Before making any modifications to the Microsoft Registry Editor, it is strongly recommended that you make a backup of the existing registry. For more information describing how to back up the registry, refer to Microsoft Knowledge Base article 256986
To create a Microsoft Windows user-defined service, perform the following steps:
- Open an MS-DOS command window in the Microsoft Windows 2003 Resource Kit directory (C:\Program Files\Windows Resource Kits\Tools).
To verify your command window is in the correct directory, you can issue this command:
If you are in the right directory, you will see a list of executables, including insterv.exe and srvany.exe. From now on, this directory will be referred to as: <RESKIT_DIR>
- In the command window, type this command:
INSTSRV.EXE <name of your DWA service> "<RESKIT_DIR>\SRVANY.EXE"
INSTSRV.EXE DWAService "C:\Program Files\Windows Resource Kits\Tools\SRVANY.EXE"
If the command worked, you will get a success message. You can also look in the Services applet from the Microsoft Windows Control Panel to verify that the new service was added. Open the new service and verify that the path to the executable is the correct path to srvany.exe.
- Run Registry Editor (Start -> Run then type regedit).
- Locate the following subkey:
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\<name of your DWA service>
- Right-click the sub-key from Step 3 and click New -> Key.
The Key Name should be: Parameters
- Right-click the Parameters key you just created and click New -> String Value.
The Value Name should be: Application
- Right-click the Application value you just created and click Modify. Set Value data to the absolute path to the application executable including the extension. In this case, it would be the absolute path to the script you wrote to automate the DOORS Web Access startup process.
Note: If path contains space, add it in double-quotes. Example: "C:\DOORS Web Access\startDWA.bat"
8. Close the Registry Editor.
Your new Microsoft Windows service is now ready to be started. By default, a newly created service is configured to run automatically when the system is restarted. To change this setting to Manual, run the Services applet from the Microsoft Windows Control Panel and change the Startup value to Manual.
A service set to Manual can be started in one of several ways:
- From the Services applet in Control Panel
- From the MS-DOS command prompt, with the 'net start' command
Note: The above procedure can be used to automate an application startup sequence so it can be started automatically at boot time without having to log in as a specific user to start it manually. It is not recommended that you use the Microsoft Windows "stop service" function to stop the user-defined service created with the procedure above, as it will not stop the application cleanly. We recommend that you stop the application manually -- perhaps using your stop script -- and then allow the Microsoft Windows "stop service" command to run (or the system to shut down, etcetera.). Thus, you will have to log in and manually stop the application if you want a clean, orderly stop. Alternatively, instead of using this technique to automate DWA startup, you could develop a traditional Windows service that would have all the capabilities of Windows services, and thus would be capable of fully automating both DWA startup and shutdown -- this technique is beyond the scope of this tech note.
Attached you will find a sample scripts showing one way to implement DWA startup scripts. These are sample batch files and cannot be run unmodified -- if you choose to base your scripts on them, you will have to make modifications to get them to work in your environment.
All source code and/or binaries attached to this document are referred to here as "the Program". IBM is not providing program services of any kind for the Program. IBM is providing the Program on an "AS IS" basis without warranty of any kind. IBM WILL NOT BE LIABLE FOR ANY ACTUAL, DIRECT, SPECIAL, INCIDENTAL, OR INDIRECT DAMAGES OR FOR ANY ECONOMIC CONSEQUENTIAL DAMAGES (INCLUDING LOST PROFITS OR SAVINGS), EVEN IF IBM, OR ITS RESELLER, HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
DWA start/stop scripts for Microsoft Windows: