WebSphere Application Server - Express, Version 6.0.x     Operating Systems: AIX, HP-UX, Linux, Solaris, Windows

WASService command

The WASService command line tool lets you create a Windows service for any WebSphere Application Server Java process.

You can create Windows services for WebSphere Application Server Java processes. Potential Windows services include the following server processes:
  • The default server1 process on an application server node
  • Application server processes that you create on an application server node

When the installation wizard creates a Windows service, the uninstaller program can remove the Windows service. If you use the WASService command to create a service yourself, it is your responsibility to remove the service when it is no longer valid. The uninstaller program does not remove Windows services that you create with the WASService command.

Location of the command file

The WASService.exe command file is located in the install_root\bin directory.

Command syntax

WASService.exe command syntax for starting an existing service

The command syntax is as follows:
WASService.exe [-start] "service_name" [optional startServer.bat parameters] 

WASService.exe command syntax for creating a service or updating 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]
      	

WASService.exe command syntax for deleting a service

The command syntax is as follows:
WASService.exe -remove "service_name"

WASService.exe command syntax for stopping a running service

The command syntax is as follows:
WASService.exe -stop "service_name" [optional stopServer.bat parameters]

WASService.exe command syntax for retrieving service status

The command syntax is as follows:
WASService.exe -status "service_name"

WASService.exe command syntax for encoding parameters

The command syntax is as follows:
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 WebSphere Application Server 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 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 install_root
Optional parameter that identifies the installation root directory of the WebSphere Application Server product.

Default names for Windows services that are created by the wizard

The name of the Windows service that is created by the Installation wizard is IBM WebSphere Application Server V6 - DefaultNode.

Viewing the Windows services panel

To view Windows 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.

Examples

Creating an Application Server service

This example creates a service called IBM WebSphere Application Server V6 - server2 that starts an Application Server process:
WASService -add server2
           -servername server2
           -profilePath "C:\Program Files\IBM\WebSphere\AppServer\
                     profiles\CustomProfile"
           -wasHome "C:\Program Files\IBM\WebSphere\AppServer"
           -logfile "C:\Program Files\IBM\WebSphere\AppServer\
                        profiles\CustomProfile\logs\startNode.log"
           -logRoot "C:\Program Files\IBM\WebSphere\AppServer\
                        profiles\CustomProfile\logs"
           -restart true
After entering the command, messages that are similar to those in the following example display in the command window:
Adding Service: server2
        Config Root: C:\Program Files\IBM\WebSphere\AppServer\
                        profiles\CustomProfile\config
        Server Name: server2
        Profile Path: C:\Program Files\IBM\WebSphere\AppServer\
                        profiles\CustomProfile
        Was Home: C:\Program Files\IBM\WebSphere\AppServer\
        Start Args:
        Restart: 1
IBM WebSphere Application Server V6 - server2 service successfully added.

Updating an existing Application Server service

This example updates an existing service called IBM WebSphere Application Server 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:\Program Files\IBM\WebSphere\AppServer\
                     profiles\CustomProfile"
           -stopArgs "-username user_name  -password password"
           -encodeParams

Starting and stopping 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.

Stopping a server after enabling security

If you enable security while a Windows service is running, you 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 WebSphere Application Server V6 - 
server_name 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 "Updating an existing application server service" example.




Related tasks
Automatically restarting server processes

Related reference
Access problems after enabling security

Reference topic    

Terms of Use | Feedback

Last updated: Jun 8, 2005 12:45:23 PM EDT
http://publib.boulder.ibm.com/infocenter/wasinfo/v6r0/index.jsp?topic=/com.ibm.websphere.express.doc/info/exp/ae/rins_wasservice.html

© Copyright IBM Corporation 2004, 2005. All Rights Reserved.
This information center is powered by Eclipse technology. (http://www.eclipse.org)