Register Service (LINUX)

Registering WebSphere as a linux service is straight forward. User the wasservice script which is held in the $was_home/bin directory (default is /opt/IBM/WebSphere/AppServer/bin).

#!/bin/bash
cd $WAS_HOME/bin
./wasservice.sh -add Dmgr -serverName dmgr \
                -profilePath /opt/IBM/WebSphere/AppServer/profiles/Dmgr01 \
                -stopArgs '-username wasadmin -password password'\
                -encodeParams
./wasservice.sh -add Node -serverName nodeagent \
                -profilePath /opt/IBM/WebSphere/AppServer/profiles/AppSrv01 \
                -stopArgs '-username wasadmin -password password -stopservers'\
                -encodeParams
chkconfig --add Dmgr_was.init
chkconfig --add Node_was.init
chkconfig --level 2345 Dmgr_was.init on
chkconfig --level 2345 Node_was.init on

Running the wasservice commands with the appropriate arguments (see example above for syntax), will create a service for the Deployment manager and Nodeagent servers. Adding the –stopArgs will allow you to add the wasadmin user and password here so it is not held in a file or is required when the service runs. Adding the –stopservers argument to the nodeagent server will stop the WebSphere servers on the node when the nodeagent is stopped If you now list the contents of /etc/init.d the services can be seen.

bild2