Operating Systems: , Linux, Windows
WASService command
The WASService command line tool enables you create a service for a product Java process on Linux and Windows operating systems.
We can create services for WAS Java processes. Potential services include the following server processes:
- The default server1 process on an appserver node
- Application Server processes created on an application server node
- The nodeagent process on an appserver node that is part of a dmgr cell
- The dmgr process, dmgr
(Windows)
Do not add an appserver that is part of a federated or managed node as a Windows service. Use the node agent to manage federated nodes.
(Windows) To set up and run this function on a Microsoft Windows operating system, the user must belong to the administrator group and have the following advanced user rights:
- Act as part of the operating system
- Log on as a service
Location of the command file
[Linux] The wasservice.sh command file is located in...
APP_ROOT\bin
(Windows) The WASService.exe command file is located in...
APP_ROOT\binCommand syntax
Command syntax for starting an existing service
The command syntax is as follows:
[Linux]wasservice.sh -start service_name [optional startServer.bat parameters]
(Windows)
WASService.exe -start service_name [optional startServer.bat parameters]
Command syntax for creating a service or updating an existing service
The command syntax is as follows:
[Linux]wasservice.sh -add service_name -serverName server_name -profilePath server_profile_directory [-wasHome APP_ROOT] [-startArgs additional_start_arguments] [-stopArgs additional_stop_arguments] [-userid user_id -password password]
(Windows)
WASService.exe -add service_name -serverName server_name -profilePath server_profile_directory [-wasHome APP_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 | false] [-startType automatic | manual | disabled]
Command syntax for deleting a service
The command syntax is as follows:
[Linux]wasservice.sh -remove service_name
(Windows)
WASService.exe -remove service_name
Command syntax for stopping a running service
The command syntax is as follows:
[Linux]wasservice.sh -stop service_name [optional stopServer.bat parameters]
(Windows)
WASService.exe -stop service_name [optional stopServer.bat parameters]
Command syntax for retrieving service status
The command syntax is as follows:
[Linux]wasservice.sh -status service_name
(Windows)
WASService.exe -status service_nameParameters
Supported arguments include:
Default names for services that are created by the wizard
The names of the services that the Profile Management Tool can create are:
After creating a custom profile, federate the node to create a node agent server on the node. We can also use the admin console of the dmgr to create appserver processes on the node. We can create a Windows service for the node agent server process.
A node agent server is also created after adding an appserver node to a dmgr cell. We can create a service for the node agent server process as described later.
View the services panel
To view services, open the Control panel and click Administrative Tools > Services. Select 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.
(Windows)
Examples
Example
This example creates a service called IBM WAS V6.x - name_of_the_deployment_manager_service that starts the dmgr process:
WASService -add name_of_the_deployment_manager_service -servername deployment_manager_server_name -profilePath $WP_PROFILE -wasHome APP_ROOT -logFile $WP_PROFILE\logs\WS_startManager.log -logRoot $WP_PROFILE\logs\deployment_manager_server_name -restart truewhere
- name_of_the_deployment_manager_service is the name to give to the service
- deployment_manager_server_name is the name of the server
After entering the command, messages that are similar to those in the following example display in the command window:
Add Service: name_of_the_deployment_manager_service Config Root: $WP_PROFILE\config Server Name: deployment_manager_server_name Profile Path: $WP_PROFILE Was Home: APP_ROOT Start Args: Restart: 1 IBM WAS V6.x - name_of_the_deployment_manager_service service successfully added.Click Start > Settings > Control Panel > Administrative Tools > Services to work with the new service.
Example
This example creates a service called IBM WAS V6.x - name_of_the_node_agent_service that starts the nodeagent process:
WASService -add name_of_the_node_agent_service -servername node_agent_server_name -profilePath $WP_PROFILE -wasHome APP_ROOT -logFile $WP_PROFILE\logs\WS_startNode.log -logRoot $WP_PROFILE\logs\node_agent_server_name -restart truewhere
- name_of_the_node_agent_service is the name to give to the service
- node_agent_server_name is the name of the server
After entering the command, messages that are similar to those in the following example display in the command window:
Add Service: name_of_the_node_agent_service Config Root: $WP_PROFILE\config Server Name: node_agent_server_name Profile Path: $WP_PROFILE Was Home: APP_ROOT Start Args: Restart: 1 IBM WAS V6.x - name_of_the_node_agent_service service successfully added.
Example
This example creates a service called IBM WAS V6.x - name_of_the_application_server_service that starts an appserver process:
WASService -add name_of_the_application_server_service -servername application_server_name -profilePath $WP_PROFILE -wasHome APP_ROOT -logFile $WP_PROFILE\logs\WS_startServer.log -logRoot $WP_PROFILE\logs\application_server_name -restart truewhere
- name_of_the_application_server_service is the name to give to the service
- application_server_name is the name of the server
After entering the command, messages that are similar to those in the following example display in the command window:
Add Service: name_of_the_application_server_service Config Root: $WP_PROFILE\config Server Name: application_server_name Profile Path: $WP_PROFILE Was Home: APP_ROOT Start Args: Restart: 1 IBM WAS V6.x - name_of_the_application_server_service service successfully added.
Example
This example for the Windows operating system updates an existing service called IBM WAS V6.x - Server2 Service with additional stop arguments, the user name and password. The parameters are automatically passed into the script that the Windows service uses to shutdown the system.
WASService -add "Server2 Service" -servername server2 -profilePath $WP_PROFILE -logRoot $WP_PROFILE\logs\server2 -stopArgs "-username user_name -password password" -encodeParams(Windows)
Starting and stopping a server process after creating a Windows service
For this Windows operating system example, if we 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 we 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 we 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.
Related tasks
Automatically restarting server processes
Related
Access problems after enabling security