I keep getting asked how to automatically start WebSphere Application Server (WAS) server instances upon restart of the Windows Server.
To do so there is a nice little tool provided with WAS called WASService which adds the server instance as a Windows service:
So for example, to add a service called “lcMisc“ based on a server definition “lcMisc” you would add it like this:
The credentials specified with -userid define the local or domain user account who will be used to start the service.
NOTE: When WAS admin security is enabled you need to provide that information with -stopArgs. Otherwise you won’t be able to stop the server through Services.msc.
When looking at Services.msc you should see the service you have just created:
You can also use WASService to remove the service:
NOTE: When you need to update the configuration of the service (e.g. changed credentials), just re-use the -add command as shown above with the changed information.
The configuration of the service is stored in Windows registry in HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\
OPTIONAL: Sometimes you need to start services in a specific order, let’s say database first and WAS server second. To do so, please follow the instructions on How to delay loading of specific services in the Microsoft Knowledge Base.
Basically, you need to add a value called “DependOnService” with a data type of REG_MULTI_SZ to the service definition and add the name of the service it depends on as the data of that value. For example:
NOTE: As this value is of type REG_MULTI_SZ you can provide more than one service name (each on a separate line).
In the following example, “nodeagent” needs DB2 and Lotus Domino to be started while itself is a pre-condition for “lcApps” and “lcMisc” services.
NOTE: You can’t modify these dependencies in Services.msc, you have to modify the Windows registry instead.