Sun Java System Application Server Enterprise Edition 8.1 2005Q2 管理指南

在 Microsoft Windows 平台上自动重新启动

要在 Microsoft Windows 上自动重新启动,请创建一个 Windows 服务。结合使用 Sun Java System Application Server 附带的 appservService.exeappserverAgentService.exe 可执行文件以及 Microsoft 提供的 Service Control 命令 (sc.exe) 。

Windows XP 附带了 sc.exe 命令,该命令位于 C:\windows\system32 目录或 C:\winnt\system32 目录中。编写本文档时,已经可以从 http:// ftp://ftp.microsoft.com/reskit/win2000/sc.zip 下载 Windows 2000 sc.exe。有关使用 sc.exe 的更多信息,请参见 http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dndllpro/html/msdn_scmslite.asp

使用 appservService.exeappservAgentService.exe,如下所示:

C:\winnt\system32\sc.exe create service-name binPath= \"fully-qualified-path-to-appservService.exe 
\"fully-qualified-path-to-asadmin.bat start-command\" 
\"fully-qualified-path-to-asadmin.bat stop-command\"" 
start= auto DisplayName= "display-name"

例如,要创建用于启动和停止域 domain1 的名为 SunJavaSystemAppServer DOMAIN1 的服务,请使用密码文件 C:\Sun\AppServer\password.txt

C:\windows\system32\sc.exe create domain1 binPath= 
"C:\Sun\AppServer\lib\appservService.exe \"C:\Sun\AppServer\bin\asadmin.bat 
start-domain --user admin --passwordfile C:\Sun\AppServer\password.txt domain1\" 
\"C:\Sun\AppServer\bin\asadmin.bat stop-domain domain1\"" start= auto 
DisplayName= "SunJavaSystemAppServer DOMAIN1"

要创建用于启动和停止节点代理 agent1 的服务,请使用:

C:\windows\system32\sc.exe create agent1 binPath= 
"C:\Sun\AppServer\lib\appservAgentService.exe \"C:\Sun\AppServer\bin\asadmin.bat 
start-node-agent --user admin --passwordfile C:\Sun\AppServer\password.txt agent1\" 
\"C:\Sun\AppServer\bin\asadmin.bat stop-node-agent agent1\"" start= auto 
DisplayName= "SJESAS_SE8.1 AGENT1"

注 –

作为 binPath= 参数的一部分而输入的启动和停止命令的语法必须正确。要进行测试,请在命令提示符下运行这些命令。如果这些命令不能正确启动或停止域或节点代理,则说明该服务不能正常工作。



注 –

请勿混合使用 asadmin startstop 命令与服务启动和停止命令。否则,可能导致服务器状态不同步。例如,即使组件没有运行,服务可能也不会显示已启动组件。为避免发生这种情况,请在使用服务时始终使用 sc.exe 命令来启动和停止组件。