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

在 Microsoft Windows 平台上自動重新啟動

若要在 Microsoft Windows 上自動重新啟動,請建立一個 Windows 服務。將 Sun Java System Application Server 隨附的 appservService.exeappserverAgentService.exe 可執行檔與 Microsoft 提供的服務控制指令 (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 指令啟動和停止元件。