beautypg.com

Sun Microsystems GLASSFISH ENTERPRISE 820433510 User Manual

Page 224

background image

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"

Note –

There is no space between binpath and the equals sign (=). There must be a space after

the equals sign and before the path.

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=

"SunJavaSystemAppServer AGENT1"

Note –

The start and stop commands entered as part of the binPath= parameter must have the

correct syntax. To test, run the commands from the command prompt. If the commands do not
properly start or stop the domain or node agent, the service does not work correctly.

Note –

Don’t use a mixture of asadmin start and stop commands and service start and stops.

Mixing the two can cause the server status to be out of sync. For example, the service might not
show that the component has started even though the component is not running. To avoid this
situation, always use the sc.exe command to start and stop the component when using
services.

If your sc.exe create command did not properly create the service, delete the service and try
again. To delete the service, use the sc.exe delete "service-name" command.

Restarting Automatically on the Microsoft Windows Platform

Sun GlassFish Enterprise Server 2.1 Administration Guide • December 2008

224