In Connections, you can have a lot of individual jvm’s running on a node. To have these all start automatically when the system starts, you have basically 2 options:

  • create services for the nodeagent, and every individual server you want to start.
  • create a service for the nodeagent, and have the nodeagent start these for you (AUTOSTART).

I prefer the latter solution, because that way I only have a single service on the OS level. There is a problem with that, however.
This works fine for starting the system, but not so for stopping the system : since there is only a service for the nodeagent, the nodeagent will stop, but the servers will remain running

Create a file stopAllServers.sh/bat by copying stopServer.sh/bat , in the /bin directory (eg. /opt/IBM/WebSphere/AppServer/profiles/AppServer01/bin).
Create a copy from stopServer.sh/bat and add following lines :

#!/bin/sh  
binDir=`dirname ${0}`  
. ${binDir}/setupCmdLine.sh  
echo "Stopping all servers on the node"
${binDir}/wsadmin.sh -lang jython -c "AdminServerManagement.stopAllServers(\"${WAS_NODE}\")"
  
${WAS_HOME}/bin/stopServer.sh "$@"  

Create the service, using the wasservice.sh/bat script , for the nodeagent :

cd /opt/IBM/WebSphere/AppServer/bin  
./wasservice.sh -add nodeagent -serverName nodeagent -profilePath /opt/IBM/WebSphere/AppServer/profiles/AppServer01 -wasHome /opt/IBM/WebSphere/AppServer -userid  

Then, in the service file /etc/init.d/nodeagent_was.init that’s created, replace the line

stopScript=stopServer.sh  

with

stopScript=stopAllServers.sh  

(I don’t know how to do this in Windows, but I’m sure there’s a way :-) )

In Linux, you could use this :

sed -i 's/stopScript=stopServer.sh/stopScript=stopAllServers.sh/g' /etc/init.d/nodeagent_was.init  

Now, if you use the service to stop your nodeagent, first all servers running on it will be stopped (this does require your dmgr to be up and running, btw).

Update

When you use the registered service you can parse options to stopNode.sh|bat, so when you add -stopArgs "-stopservers" to the wasservice command, the servers will shutdown with the nodeagent and no additional scripts are needed (thanks Christoph Stoettner).