Sun Java System Application Server Enterprise Edition 8.1 Administration Guide 2005Q1 |
Appendix B
Automatically Restarting a Domain or Node AgentIf your domain or node agent is stopped unexpectedly (for example, if you need to restart your machine), you can configure your system to automatically restart the domain or node agent.
This Appendix contains the following topics:
Restarting Automatically on UNIX PlatformsTo restart your domain on a UNIX platform, add a line of text to the
/etc/inittab
file.For example, to restart domain1, for an Application Server installed in the
opt/SUNWappserver
directory, using a password file calledpassword.txt
:das:3:respawn:/opt/SUNWappserver/bin/asadmin start-domain --user admin --passwordfile /opt/SUNWappserver/password.txt domain1
Put the text on one line. The first three letters are a unique designator for the process and can be altered.
To restart a node agent, the syntax is similar. For example, to restart agent1, for an Application Server installed in the
opt/SUNWappserver
directory, using a password file calledpassword.txt
:das:3:respawn:/opt/SUNWappserver/bin/asadmin start-node-agent --user admin --passwordfile /opt/SUNWappserver/password.txt agent1
Restarting Automatically on the Microsoft Windows PlatformTo restart automatically on Microsoft Windows, create a Windows Service. Use the
appservService.exe
andappserverAgentService.exe
executables shipped with Sun Java System Application Server in conjunction with the Service Control command (sc.exe
) provided by Microsoft.The
sc.exe
command comes with Windows XP and is either located in theC:\windows\system32
directory orC:\winnt\system32
directory. As of this writing, the Windows 2000sc.exe
is available for download at: ftp://ftp.microsoft.com/reskit/win2000/sc.zip. For more information on usingsc.exe
, see http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dndllpro/html/msdn_scmslite.asp.Use
appservService.exe
andappservAgentService.exe
as follows: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"For example, to create a service called SunJavaSystemAppServer DOMAIN1 that starts and stops the domain
domain1
, using a password file 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"
To create a service that starts and stops the node agent
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"
Security for Automatic RestartsHandle the password and master password required when starting in one of the following ways:
- On Microsoft Windows, configure the service to ask the user for the password.
- In the Services Control Panel, double-click the service you created.
- In the Properties window, click the Log On tab.
- Check “Allow service to interact with desktop” to prompt for the required passwords when starting the component.
You have to log in to see the prompts, and entries are not echoed back as you type them. This method is the most secure way to use the services option, but user interaction is required before the service becomes available.
If the “interact with desktop” option is not set, the service stays in a “start-pending” state and appears to hang. Kill the service process to recover from this state.
- On Windows or UNIX, create a domain using the
--savemasterpassword=true
option and create a password file to store the admin password. When starting the component, use the--passwordfile
option to point to the file that contains the password.
For example:
- Create domain with a saved master password. In this syntax, you are prompted for the admin password and master password:
asadmin create-domain --adminport 4848 --adminuser admin --savemasterpassword=true --instanceport 8080 domain1
- On Windows, create a service using a password file to populate the admin password:
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= "SJESAS_PE8.1 DOMAIN1"
The path to the password file
password.txt
isC:\Sun\AppServer\password.txt
. It contains the password in the following format
AS_ADMIN_password=
passwordFor example, for a password
adminadmin
:
AS_ADMIN_password=adminadmin