Restarting Automatically on the Microsoft Windows Platform

Restarting Automatically Using inittab on Solaris 9 and Linux Platforms

To restart your domain on the Solaris 9 or Linux platform, add a line of text to 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 command.

For example, to restart domain1 for an Enterprise 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 Enterprise Server installed in the opt/SUNWappserver directory, using a password file called password.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 Platform

To restart automatically on Microsoft Windows, create a Windows Service and prevent the service from shutting down when a user logs out.

Creating a Windows Service

Use the appservService.exe and appserverAgentService.exe executable files shipped with the Sun GlassFish Enterprise Server in conjunction with the Service Control command (sc.exe) provided by Microsoft.

The sc.exe command comes with Windows XP and is in the system32 subdirectory of the Windows installation directory (usually either C:\windows\system32 or C:\winnt\system32). As of this writing, the Windows 2000 sc.exe is available for download at ftp://ftp.microsoft.com/reskit/win2000/sc.zip. For more information on using sc.exe, see http://msdn.microsoft.com/library/default.asp? url=/library/en-us/dndllpro/html/msdn_scmslite.asp.

Use appservService.exe and appservAgentService.exe as follows:

Appendix A • Automatically Restarting a Domain or Node Agent

223

Page 223
Image 223
Sun Microsystems 820433510 manual Creating a Windows Service, Restarting Automatically on the Microsoft Windows Platform