Mercury As A Service


Question: What is the best way to get GUI access to adminster Mercury settings? can you run the GUI while the service is running? or is it better to STOP the service and start the application to administer the application? If relevant I am using NTWrapper on W2K3.

I believe that if you use "Interact with desktop", then it should be accessible when a user is logged on. You can contact Arno, the program's author, and ask.

JamesNewton says: It does appear after logging in with "Interact with desktop" set. There is not need to stop the service and restart as GUI. I did find it necessary to use the Mercury Loader rather than the actual Mercury program in the setup of NTWrapper, so that the changes I made to configuration items would be saved when I exited the program, but that was true outside of NTWrapper as well.


Mercury/32 was designed as a Windows GUI application and therefore cannot act as a native NT service application. However it's possible to run it in a so called Service Wrapper that handles communication to and from the Windows Service Control Manager on behalf of Mercury.

Given both the wrapper tool and Mercury are set up properly, current versions of Mercury/32 run very reliable as a service. Note that it is especially important to turn off option "Hard To Quit" in Mercury and that the wrapper is capable and properly setup to shutdown Mercury gracefully.

Some service wrappers:

For this example, I used NT Wrapper which is free for noncommercial use. Also, NT Wrapper has some enhanced features like the ability to run a wrapped process as a different user than the service start account, which is i.e. usefull if Mercury needs access to user/mail accounts on a Netware server.

First, download and install NT Wrapper. Next, start the NT Wrapper GUI and create a new service like shown below.

A simple standard installation:

svcgen.png

Option "Interact with Desktop" should be enabled.

svcenh.png

In W2K and better option "On all Apps. Exit" should be set to "Service terminates...", this option allows the operating system to apply Service Recovery Actions (adjustable in Windows service manager) when the service stops unexpectedly.

svcdep.png

I've set the dependencies to service Tcpip and to service group Network to make sure these services are already up and running when the Mercury service is started.

appgen.png

The free version of NT Wrapper is limited to one service instance, however within an instance multiple applications can be wrapped, the first Application Entry is auto-created, enter the the Mercury EXE here.

appenh.png

Ticking "Process Group" allows NT Wrapper to close all child processes spawned by Mercury/32 before Mercury itself will be closed when the service stops. If this is a Windows NT system enable option "Restart Application" if you want Mercury being restarted when it exits unexpectedly. Unfortunately Mercury does not exit and restart as a daily maintanance task when it wasn't started by launcher.exe :( the wrapper could bring it up again instead.

apptras.png

Shutdown Timeout should be long enough to give Mercury a chance to exit gracefully when the service stops. 10 sec. appears to be fine (in my environment), however one should check the event logs for warnings from time to time and increase that value if Mercury couldn't be closed gracefully. It is very important that Mercury is given enough time to unload its DLLs and save its settings to various INI-files etc. I've for instance not checked how long Mercury takes while it is busy with content control (i.e. parsing a large attachment), 10 sec. *may be far too short. Note that Mercury would never shutdown gracefully if Mercury-option "Hard To Quit" is turned on.

If option Restart Application was enabled before make sure you assign a proper value here to Launch Delay as well! If the launch delay is too short it may happen that NT Wrapper will try to restart Mercury while the system is going to shutdown.

That's it, press button Install and then start the service.

How to use feature "Run as user" to enable Mercury to access Netware user accounts. (still missing).


One page links to MercuryAsAService:
 . Page Name .   . Last Modified . 
 Mercury32   June 28, 2006 8:39 am