WASService command

 

+

Search Tips   |   Advanced Search

 

 

Overview

The WASService command line tool enables you create a service for a product Java process.

You can create services for WAS Java processes. Potential services include the following server processes:

The wasservice.sh|ext command file is located in...

app_server_root/bin

 

Command syntax

 

Start an existing service

wasservice.[sh|exe] -start service_name [optional startServer.bat parameters]

 

Create a service or update an existing service

For *nix...

 wasservice.sh -add service_name
              -serverName server_name
              -profilePath server_profile_directory
              [-wasHome app_server_root]
              [-startArgs additional_start_arguments]
              [-stopArgs additional_stop_arguments]
              [-userid user_id -password password]

For Windows...

 WASService.exe -add service_name
               -serverName server_name
               -profilePath server_profile_directory
               [-wasHome app_server_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]

 

Delete a service

For *nix...

wasservice.sh -remove service_name

For Windows...

WASService.exe -remove service_name

For windows, verify the Java process is gone and reboot the Windows system after deleting.

 

Stop running service

For *nix...

wasservice.sh -stop service_name [optional stopServer.bat parameters]

For Windows...

WASService.exe -stop service_name [optional stopServer.bat parameters]

 

Retrieve status

For *nix...

wasservice.sh -status service_name

For Windows...

WASService.exe -status service_name

 

Encode syntax for encoding parameters

For Windows...

WASService.exe -encodeParams service_name

 

Parameters

Supported arguments include:

-add service_name

Creates a service named service_name or updates an existing 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.

For Windows, to 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 server_name.pid to determine if the server is running.

-profilePath server_profile_directory

Specifies the 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. You 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 app_server_root

Optional parameter that identifies the installation root directory of the product.

 

Default names for services that are created by the wizard

The names of the services that the Profile Management tool can create are:

Deployment manager

IBM WAS V6.x - node_name_of_the_deployment_manager_node

Application server

IBM WAS V6.x - node_name_of_the_server1_node

Custom profile

After federating the node and creating an appserver, a service can be created called...

IBM WAS V6.x - node_name_of_the_managed_node

After creating a custom profile, federate the node to create a node agent server on the node. You can also use the console of the deployment manager to create appserver processes on the node. You can create a Windows service for the nodeagent server process or the appservers on the node.

A node agent server is also created after adding an appserver node to a deployment manager cell. You can create a service for the nodeagent 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.

 

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 profile_root    
           -wasHome app_server_root       
           -logFile profile_root\logs\WS_startManager.log
           -logRoot profile_root\logs
           -restart true
where

After entering the command, messages that are similar to those in the following example display in the command window:

Adding Service: name_of_the_deployment_manager_service
   Config Root: profile_root\config
   Server Name: deployment_manager_server_name
   Profile Path: profile_root    Was Home: app_server_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 profile_root    -wasHome app_server_root    -logFile profile_root\logs\WS_startNode.log
   -logRoot profile_root\logs
   -restart true
where

After entering the command, messages that are similar to those in the following example display in the command window:

Adding Service: name_of_the_node_agent_service
   Config Root: profile_root\config
   Server Name: node_agent_server_name
   Profile Path: profile_root    Was Home: app_server_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 profile_root    -wasHome app_server_root    -logFile profile_root\logs\WS_startServer.log
   -logRoot profile_root\logs
   -restart true
where

After entering the command, messages that are similar to those in the following example display in the command window:

Adding Service: name_of_the_application_server_service
  Config Root: profile_root\config
  Server Name: application_server_name
  Profile Path: profile_root   Was Home: app_server_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 user name and password are not required by the stopServer command to stop the appserver with security enabled. The parameters are automatically passed into the script that the Windows service uses to shutdown the system.

WASService -add "Server2 Service"
   -servername server2
   -profilePath profile_root    -stopArgs "-username user_name  -password password"
   -encodeParams

 

Start and stopping a server process after creating a Windows service

For this Windows operating system example, 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.



 

Related tasks

Automatically restarting server processes

 

Related Reference

Access problems after enabling security