Skip to content

Autostart IBM WebSphere Application Server

There are many different ways that you can start the WebSphere Application Servers associated with IBM Connections.

Manually, automatically via a Service or via a script or batch file

Manually takes time and requires my typing or copy and pasting to the command line

Automatically via a service can often be the easiest way to start the servers (assuming the monitoring policy is set correctly) - Set the Deployment Manager and Nodeagents as Services - Register Services with wasservice.bat|sh - Application Servers start and stop through Monitoring Policies

Or

Using a script – run one command and start all the connections servers in one swoop. - Create a windows bat file to start and stop the services – using the windows NETSTART and NETSTOP commands - Download Linux Init Script from Tim Clark & Sharon Bellamy (see resources) – edit the parameters in the script file, copy to /etc/ and run connctrl {start|stop} {0|3|4} {nru} (0=just 1 IC server 3=3 IC servers 4=4 IC servers nru = if you are using a user other than root)

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).

Bash
#!/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

Register Service (WINDOWS)

Registering a WebSphere windows services are very similar to adding a linux service.

From a cmd prompt:

Change directory to %WAS_HOME%/bin – in this example it is D:\IBM\WebSphere\AppServer\bin

The syntax of the command is wasservice –add <service name> -serverName <name of server> -profilePath <path to server profile>

To enable the server to restart automatically and to encode the user name and password additional parameters are required

wasservice -add Dmgr -serverName dmgr -profilePath D:\IBM\WebSphere\AppServer\profiles\Dmgr01 -encodeParams -restart true -startType automatic -stopArgs "-username wasadmin -password password"

wasservice -add Node -serverName nodeagent -profilePath D:\IBM\WebSphere\AppServer\profiles\AppSrv01 -encodeParams -restart true -startType automatic -stopArgs '-username wasadmin -password password -stopservers'

Once the wasservice command has been run successfully the new services will be visible within the services view: bild3

Set Monitoring Policy

To enable the Connections servers to start and stop correctly when using services the monitoring policy must be set.

Using the Web Console to set the monitoring policy

  1. Log in to the ISC
  2. Open each Application Server
  3. Server Infrastructure – Java and Process Management – Monitoring Policy bild4
  4. Change Node restart state to “RUNNING” bild5
  5. Ensure that the configuration is saved before quitting the ISC, when the server is restarted the monitoring policy will be set.

NOTE: Ensure that the monitoring policy is set to STOPPED when applying fix packs and ifixes.

Using a script to set the monitoring policy

Change directory to the /bin directory. Run the config monitoring policy script (cfgMonitoringPolicy.py)

Bash
./wsadmin.sh -lang jython -f cfgMonitoringPolicy.py

A prompt is presented asking which state you would like to set stopped, running or previous.

bild6

Once complete the script will synchronise the changes to the nodeagents.

Again note that prior to applying fix packs or ifixes the monitoring policy should be set to STOPPED.

Using a Windows Batch File

If you prefer to start and stop the Connections services manually create a windows service (as per the instructions here) for the Deployment Manager, Node Agents and each Connections Server.

Create a windows batch file to call the Windows services using the NET START command

Bash
REM **** Example of start servers batch file ****
@echo off
echo Starting DeploymentManager
NET START "IBMWAS80Service - Dmgr"
echo Starting NodeAgent
NET START "IBMWAS80Service - Node"
echo Starting server Cubey
NET START "IBMWAS80Service - Cubey"
echo Servers started now exiting
pause
exit

A start of the servers can then be achieved by running the batch file. The Windows services are started in turn.

bild7

A similar windows batch file can be created to stop all of the windows services.

Using the Linux Connctrl Script

If you prefer to manually start the Connections servers under linux by far the easiest way is to use the connctrl script (see the resource section for the link).

Copy the connctrl script to the /etc directory and edit the variables

Bash
#######################################################
# Variables                                           #
#######################################################
# Please amend these to match your local environment #
#######################################################
WSDM=/opt/IBM/WebSphere/AppServer/profiles/Dmgr01/bin   # WebSphere Deployment Manager path
WAS=/opt/IBM/WebSphere/AppServer/profiles/AppSrv01/bin  # WebSphere Application Server path
NRU=wasadmin      # NonRootUser that owns WebSphere instance if not 'root'
N=ConnCtrl
# Connections Servers #
# This is whatever you called the Connections server instances #
CS=IC45_server1     #this is for a single JVM only
CS1=pcf_server1 #If multiple Connections servers list them here
CS2=infra_server1   #If multiple Connections servers list them here
CS3=apps_server1    #If multiple Connections servers list them here
CS4=fw_server1      #If multiple Connections servers list them here

Once the variables have been changed save the file

The script is then called from /etc

Bash
/etc/connctrl.sh

Usage: ConnCtrl {start|stop} {0|3|4} {nru}
0=just 1 IC server, 3=3 IC servers & 4=4IC servers
nru = if you are using a user other than root

i.e /etc/connctrl.sh stop 4 wasadmin or /etc/connctrl start 0

The script will start and stop the servers in a similar way to the windows batch files, each server in turn is stopped (or started).