The following topics are addressed here:
When you start a domain or server, the domain administration server (DAS) is started. After startup, the DAS runs constantly, listening for and accepting requests.
If the domain directory is not specified, the domain in the default as-install/domains directory is started. If there are two or more domains, the domain_name operand must be specified. Each domain must be started separately.
If you want the domain you are starting to be able to use the restart-domain subcommand, the --watchdog option must be set to true (true is the default). If you have set the --watchdog option to false, the domain will not be able to use the restart-domain subcommand.
For Microsoft Windows, you can use an alternate method to start a domain. From the Windows Start menu, select Programs -> Sun Microsystems ->Enterprise Server -> Start Admin Server.
This subcommand is supported in local mode only.
Start a domain by using the start-domain(1) subcommand.
This example starts domain2 in the default domain directory.
asadmin> start-domain domain2 |
If there is only one domain, you can omit the domain name. If you do not include the password, you might be prompted to supply it.
Name of the domain started: [domain1] and its location: [C:\prelude\v3_prelude_release\distributions\web\target\glassfish domains\domain1]. Admin port for the domain: [4848]. |
You can also view the full syntax and options of the subcommand by typing asadmin help start-domain at the command line.
Stopping a domain or server shuts down its domain administration server (DAS). When stopping a domain, the DAS stops accepting new connections and then waits for all outstanding connections to complete. This shutdown process takes a few seconds. While the domain is stopped, the Administration Console and most of the asadmin subcommands cannot be used. This subcommand is particularly useful in stopping a runaway server. For more controlled situations, you can use the restart-domain(1) subcommand.
For Microsoft Windows, you can use an alternate method to stop a domain. From the Start menu, select Programs -> Sun Microsystems -> Enterprise Server -> Stop Admin Server.
If necessary, notify users that you are going to stop the domain.
Stop the domain by using the stop-domain(1) subcommand.
This example stops domain1 in the default directory, where domain1 is the only domain present in the directory.
asadmin> stop-domain Waiting for the domain to stop ........... Command stop-domain executed successfully. |
You can also view the full syntax and options of the subcommand by typing asadmin help stop-domain at the command line.
Use the restart-domain subcommand in remote mode to restart the Domain Administration Server (DAS) of the specified host. When restarting a domain, the DAS stops accepting new connections and then waits for all outstanding connections to complete. This shutdown process takes a few seconds. Until the domain has restarted, the Administration Console and most of the asadmin subcommands cannot be used.
This subcommand is particularly useful for environments where the server machine is secured and difficult to get to. With the right credentials, you can restart the server from a remote location as well as from the same machine.
If the server will not restart, use the stop-domain(1) subcommand followed by the start-domain(1) subcommand.
For the restart-domain subcommand to work, the --watchdog option of the start-domain subcommand must have been set to true (the default) when the domain was started. If this option was set to false and you attempt to restart the domain, the domain is stopped and a warning message is logged. If the --watchdog option is set to false, you can only restart the domain by using the stop-domain and start-domain subcommands.
Ensure that the server is running.
Remote subcommands require a running server.
Restart the domain by using the restart-domain(1) subcommand.
This example restarts mydoimain4 in the default directory.
asadmin> restart-domain mydomain4 Waiting for the domain to restart ........... Command restart-domain executed successfully. |
This example invokes the restart-domain subcommand in a browser.
http://yourhost:4848/__asadmin/restart-domain |
You can also view the full syntax and options of the subcommand by typing asadmin help restart-domain at the command line.
This section provides instructions for configuring your system to automatically restart the domain on Solaris.
The following topics are addressed here:
The create-service subcommand is supported on the Solaris and Windows platforms, however, only Solaris instructions are provided here.
On Solaris 10, you can use the asadmin create-service subcommand to create a Solaris Service Management Facility (SMF) service that restarts a Domain Administration Server (DAS). The service grants to the process the privileges of the user that runs the process. When you create an SMF service, the default user is the superuser. If you require a different user to run the process, specify the user in method_credential.
If your process is to bind to a privileged port of Solaris 10, the process requires the net_privaddr privilege. The privileged ports of the Solaris operating system have port numbers less than 1024.
To determine if a user has the net_privaddr privilege, log in as that user and type the command ppriv -l | grep net_privaddr.
After you create and enable the SMF service, if the domain goes down, SMF restarts it.
To run the asadmin create-service subcommand, you must have solaris.smf.* authorization. See the useradd and usermod man pages to find out how to set the authorizations. You must also have write permission in the directory tree: /var/svc/manifest/application/SUNWappserver. Usually, the superuser has both of these permissions. Additionally, the Solaris 10 administration commands such as svccfg, svcs, and auths must be available in the PATH.
If a particular Enterprise Server domain should not have default user privileges, modify the manifest of the service and reimport the service.
Create the service by using the create-service(1) subcommand.
Information about properties for the subcommand is included in this help page.
After the service is created, enable the service by using the svacdm enable subcommand.
For example:
svacdm enable /appserver/domains/domain1 |
This example creates a service .
asadmin> create-service The Service was created successfully. Here are the details: Name of the service:application/GlassFish/domain1 Type of the service:Domain Configuration location of the service:/home/gfuser/glassfish-installations /glassfishv3/glassfish/domains Manifest file location on the system:/var/svc/manifest/application /GlassFish/domain1_home_gfuser_glassfish-installations_glassfishv3 _glassfish_domains/Domain-service-smf.xml. You have created the service but you need to start it yourself. Here are the most typical Solaris commands of interest: * /usr/bin/svcs -a | grep domain1 // status * /usr/sbin/svcadm enable domain1 // start * /usr/sbin/svcadm disable domain1 // stop * /usr/sbin/svccfg delete domain1 // uninstall Command create-service executed successfully |
As you administer your service, the following Solaris commands are useful: auths, smf_security, svcadm, svccfg, rbac, useradd, and usermod.
To set up automatic restart on Linux, you edit the /etc/inittab file. If you use /etc/rc.local, or your system’s equivalent, place a line in /etc/rc.local that calls the desired asadmin subcommand.
Add a line of text to the /etc/inittab file.
For example:
das:3:respawn:/opt/SUNWappserver/bin/asadmin start-domain --user admin --passwordfile /opt/SUNWappserver/password.txt domain1 |
The text must be on a single line. The first three letters are a unique designator for the process and can be altered.
By default, the Java Virtual Machine (JVM) receives signals from Windows that indicate that Windows is shutting down, or that a user is logging out of Windows, which causes the system to shut itself down cleanly. This behavior causes the Enterprise Server service to shut down. To prevent the service from shutting down when a user logs out, you must set the -Xrs Java VM option.