WASService 命令行工具允许您在 Linux 和 Windows 操作系统上为产品 Java 进程创建服务。 您可以为 WebSphere Application Server Java 进程创建服务。可能存在的服务包括下列服务器进程: 应用程序服务器节点上的缺省 server1 进程 要在 Microsoft Windows 操作系统上设置并运行此功能,用户必须属于 administrator 组,而且具有下列高级用户权限: 作为操作系统的一部分 如果要在 Microsoft Windows Vista 操作系统上启动或停止作为服务来运行的应用程序服务器,那么需要以管理员特权来运行。 使用 WASService.exe 实用程序更改服务的特征或创建新服务时,也需要以管理员特权运行。
如果将应用程序服务器安装为服务,请执行以下操作以调用“命令提示符”窗口,然后在该窗口中运行 .bat 文件来控制此服务:
命令文件的位置 wasservice.sh 命令文件位于 app_server_root\bin 目录中。 WASService.exe 命令文件位于 app_server_root\bin 目录中。 命令语法 用于启动现有服务的命令语法 命令语法如下所示:
用于创建服务或更新现有服务的命令语法 命令语法如下所示:
-serverName server_name -profilePath server_profile_directory [-wasHome app_server_root] [-startArgs additional_start_arguments] [-stopArgs additional_stop_arguments] [-userid user_id -password password]
-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]
用于删除服务的命令语法 命令语法如下所示:
用于停止正在运行的服务的命令语法 命令语法如下所示:
用于检索服务状态的命令语法 命令语法如下所示:
参数 支持的参数包括: -add service_name 创建名为 service_name 的服务或者更新现有服务。对于这两种情况,语法是相同的。 -configRoot configuration_repository_directory 可选参数,它识别 WebSphere Application Server 产品的安装根目录的配置目录。 -encodeParams service_name 可选参数,它强制服务对 -startArgs 和 -stopArgs 进行编码以使无法通过编辑注册表来确定参数。使用 -add 参数创建服务时,通过在命令行上添加不带参数的 -encodeParams 的方式使用该参数。 或者对现有服务的参数进行编码: WASService -encodeParams service_name -logFile service_log_file 识别 WASService 命令用于记录其活动的日志文件的可选参数。 -logRoot server_log_directory 识别概要文件的服务器日志目录的必需参数。WASService 命令查找名为 server_name.pid 的文件,以确定服务器是否在运行。 -profilePath server_profile_directory 指定定义服务器进程的概要文件的目录路径。 -remove service_name 删除指定的服务。 -restart true | false 设置为 true 时,在服务失败的情况下自动重新启动现有的服务。 -serverName server_name 识别服务控制的服务器。 -start service_name [optional startServer.bat parameters] 启动现有的服务。 -startArgs additional_start_arguments 识别其他参数的可选参数。 -startType automatic | manual | disabled 定义新服务的启动类型。automatic 启动类型在系统启动或第一次调用服务时自动启动。在操作系统可以装入 manual 服务并且让它可供使用之前,您必须先将它启动。您无法在更改 disabled 启动类型之前,启动该服务。 -status service_name 返回服务的当前状态,它包含服务是在运行还是停止了。 -stop service_name [optional stopServer.bat parameters] 停止指定的服务。 -stopArgs additional_stop_arguments 识别其他参数的可选参数。 -userid user_id -password password 识别 Windows 服务将以该标识运行的特权用户标识和密码的可选参数。 -wasHome app_server_root 标识产品的安装根目录的可选参数。 由向导创建的服务的缺省名称 安装向导创建的服务的名称为 IBM WebSphere Application Server V6.x - DefaultNode。 查看服务面板 要查看服务,打开控制面板并单击管理工具 > 服务。选择要查看它的信息的服务。右击该服务并单击属性。四个选项卡提供信息和功能。例如,选择常规选项卡上的设置类型字段,更改设置类型。
示例 本示例创建用于启动应用程序服务器进程的名为 IBM WebSphere Application Server V6.x - name_of_the_application_server_service 的服务: 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\application_server_name -restart true 其中 · name_of_the_application_server_service 是想要命名服务的名称 · application_server_name 是服务器的名称 输入命令后,命令窗口中会显示类似于以下示例中显示的消息的消息: 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 WebSphere Application Server V6.x - name_of_the_application_server_service service successfully added. 示例 用于 Windows 操作系统的本示例使用其他的停止参数、用户名和密码来更新名为 IBM WebSphere Application Server V6.x - Server2 Service 的现有服务。会自动将这些参数传递到 Windows 服务用来关闭系统的脚本中。 WASService -add "Server2 Service" -servername server2 -profilePath profile_root -logRoot profile_root\logs\server2 -stopArgs "-username user_name -password password" -encodeParams
对于本 Windows 操作系统示例,如果在为 server1 创建 Windows 服务后发出 startServer server1 命令或 stopServer server1 命令,那么会显示类似于以下示例的消息: 因为将 server1 注册为作为 Windows 服务方式运行,因此启动此服务器的请求将通过启动关联的 Windows 服务完成。
说明: 在windows平台上在创建profile时,系统自动创建的服务名称为IBM WebSphere Application Server V6.x - name_of_the_application_server_service 例如:IBM WebSphere Application Server V6.1 - cnooc_n-node01 注意cnooc_n-node01才是服务的名称。 相关参考 |
WASService的使用
最新推荐文章于 2021-08-09 21:04:48 发布
WASService的使用
2010年06月11日 星期五 14:12