WASService command
Overview
WASService.exe allows one to create a Windows service for any WAS Java process. Potential Windows services include...
- The default server1 process on an application server node
- Application server processes that you create on an application server node
- The nodeagent process on an application server node that is part of a deployment manager cell
- The deployment manager process, dmgr
The command syntax is as follows...
WASService.exe [-start] "service_name" [optional startServer.bat parameters]
Create a service or update an existing service
The command syntax is as follows
WASService.exe -add "service_name" -serverName server -profilePath server_profile_directory [-wasHome install_root] [-configRoot configuration_repository_directory] [-startArgs additional_start_arguments] [-stopArgs additional_stop_arguments] [-userid user_id -password password] [-logFile service_log_file] [-logRoot server_log_directory] [-restart true | -restart false] [-startType automatic | manual | disabled]
Delete a service
WASService.exe -remove "service_name"
Stop a running service
WASService.exe -stop "service_name" [optional stopServer.bat parameters]
Retrieve service status
WASService.exe -status "service_name"
Encoding parameters
WASService.exe -encodeParams "service_name"
Parameters
Supported arguments include:
- -add "service_name"
- Creates a service named service_name or updates an existing Windows service. The syntax is the same for both cases.
- -configRoot configuration_repository_directory
- Optional parameter that identifies the configuration directory of the installation root directory of a WAS product.
- -encodeParams service_name
- Optional parameter that forces the service to encode the -startArgs and -stopArgs so that the arguments cannot be determined by editing the registry. Use the parameter when creating a service with the -add parameter by adding -encodeParams to the command line with no arguments. Or encode the parameters of an existing service
WASService -encodeParams service_name- -logFile service_log_file
- Optional parameter that identifies a log file that the WASService command uses to record its activity.
- -logRoot server_log_directory
- Required parameter that identifies the server log directory for the profile. The WASService command looks for a file named servername.pid to determine if the server is running.
- -profilePath server_profile_directory
- Directory path of the profile that defines the server process.
- -remove service_name
- Deletes the specified service.
- -restart true | false
- Restarts the existing service automatically if the service fails when set to true.
- -serverName Server_name
- Identifies the server that the service controls.
- -start "service_name" [optional startServer.bat parameters]
- Starts the existing service.
- -startArgs additional_start_arguments
- Optional parameter that identifies additional parameters.
- -startType automatic | manual | disabled
- Defines the startup type of the new service. An automatic startup type starts automatically when the system starts or when the service is called for the first time. You must start a manual service before the operating system can load it and make it available. We cannot start a disabled service before changing the startup type.
- -status service_name
- Returns the current status of the service, which includes whether the service is running or stopped.
- -stop service_name [optional stopServer.bat parameters]
- Stops the specified service.
- -stopArgs additional_stop_arguments
- Optional parameter that identifies additional parameters.
- -userid user_ID -password password
- Optional parameters that identify a privileged user ID and password that the Windows service will run as.
- -wasHome install_root
- Optional parameter that identifies the installation root directory of the WAS product.
Default names for Windows services that are created by the wizard
The names of the Windows services that the Profile creation wizard can create are:
- Deployment manager
- IBM WAS V6 - node_of_the_deployment_manager_node
- Application Server
- IBM WAS V6 - node_of_the_server1_node
- Custom profile
- After federating the node and creating an Application Server, a service can be created named IBM WAS V6 - node_of_the_managed_node.
After creating a custom profile, federate the node to create a node agent server on the node. We can also use the administrative console of the deployment manager to create application server processes on the node. We can create a Windows service for the nodeagent server process or the application servers on the node.
A node agent server is also created after adding an application server node to a deployment manager cell. We can create a Windows service for the nodeagent server process as described later.
View the Windows services panel
To view Windows services, open the Control panel and click...
Administrative Tools | ServicesSelect a service to view information about it. Right click the service and click Properties. Four tabs provide information and functionality. For example, select the Setup type field on the General tab to change the setup type.
Examples
Create a deployment manager service
This example creates a service called IBM WAS V6 - dmgr that starts the dmgr process
WASService -add dmgr -servername dmgr -profilePath "C:\IBM\WebSphere\AppServer\profiles\Dmgr1" -wasHome "C:\IBM\WebSphere\AppServer" -logfile "C:\IBM\WebSphere\AppServer\profiles\Dmgr1\logs\startManager.log" -logRoot "C:\IBM\WebSphere\AppServer\profiles\Dmgr1\logs" -restart trueAfter entering the command, messages that are similar to those in the following example display in the command window
Adding Service: dmgr Config Root: C:\IBM\WebSphere\AppServer\profiles\Dmgr1\config Server Name: dmgr Profile Path: C:\IBM\WebSphere\AppServer\profiles\Dmgr1 Was Home: D:\IBM\WebSphere\AppServer\ Start Args: Restart: 1 IBM WAS V6 - dmgr service successfully added.Click...
Start | Settings | Control Panel | Administrative Tools | Services...to work with the new service.
Create a node agent service
This example creates a service called IBM WAS V6 - nodeagent that starts the nodeagent process
WASService -add nodeagent -servername nodeagent -profilePath "C:\IBM\WebSphere\AppServer\profiles\CustomProfile" -wasHome "C:\IBM\WebSphere\AppServer" -logfile "C:\IBM\WebSphere\AppServer\profiles\CustomProfile\logs\startNode.log" -logRoot "C:\IBM\WebSphere\AppServer\profiles\CustomProfile\logs" -restart trueAfter entering the command, messages that are similar to those in the following example display in the command window
Adding Service: nodeagent Config Root: C:\IBM\WebSphere\AppServer\profiles\CustomProfile\config Server Name: nodeagent Profile Path: C:\IBM\WebSphere\AppServer\profiles\CustomProfile Was Home: C:\IBM\WebSphere\AppServer\ Start Args: Restart: 1 IBM WAS V6 - nodeagent service successfully added.
Create an Application Server service
This example creates a service called IBM WAS V6 - server2 that starts an Application Server process
WASService -add server2 -servername server2 -profilePath "C:\IBM\WebSphere\AppServer\profiles\CustomProfile" -wasHome "C:\IBM\WebSphere\AppServer" -logfile "C:\IBM\WebSphere\AppServer\profiles\CustomProfile\logs\startNode.log" -logRoot "C:\IBM\WebSphere\AppServer\profiles\CustomProfile\logs" -restart trueAfter entering the command, messages that are similar to those in the following example display in the command window
Adding Service: server2 Config Root: C:\IBM\WebSphere\AppServer\profiles\CustomProfile\config Server Name: server2 Profile Path: C:\IBM\WebSphere\AppServer\profiles\CustomProfile Was Home: C:\IBM\WebSphere\AppServer\ Start Args: Restart: 1 IBM WAS V6 - server2 service successfully added.
Update an existing Application Server service
This example updates an existing service called IBM WAS V6 - server2 with additional stop arguments, username and password. The user name and password are required by the stopServer command to stop the application server with security enabled.
WASService -add server2 -servername server2 -profilePath "C:\IBM\WebSphere\AppServer\profiles\CustomProfile" -stopArgs "-username user_name -password password" -encodeParams server2
Start and stop a server process after creating a Windows service
If you issue the startServer server1 command or the stopServer server1 after creating a Windows service for server1, a message that is similar to the following example displays
Because server1 is registered to run as a Windows Service, the request to start this server will be completed by starting the associated Windows Service.If you issue the startNode command or the stopNode command after creating a Windows service for the nodeagent process, a message that is similar to the following example displays
Because nodeagent is registered to run as a Windows Service, the request to start or stop this server will be completed by starting or stopping the associated Windows Service. Examine the log files to view messages related to this command.If you issue the startManager command or the stopManager command after creating a Windows service for the deployment manager, a message that is similar to the following example displays
Because dmgr is registered to run as a Windows Service, the request to start or stop this server will be completed by starting or stopping the associated Windows Service. Examine the log files to view messages related to this command.
Stop a server after enabling security
If you enable security while a Windows service is running, one cannot stop the server from the command line, even when using the username and password parameters on the stopServer command. A message similar to the following example is displayed
Could not stop the IBM WAS V6 - servername service on Local Computer. The service did not return an error. This could be an internal Windows error or an internal service error. If the problem persists, contact your system administrator.The problem is due to the service control of the process. You must change the service to use the proper stop-server arguments for a secure server.
Use the -stopArgs parameter and the -encodeParams parameter to update the service as described in the "Update an existing application server service" example.
Related Tasks
Automatically restarting server processes
Related Information
Access problems after enabling security