#!/bin/sh # IBM_PROLOG_BEGIN_TAG # This is an automatically generated prolog. # # bos720 src/bos/usr/lpp/bosinst/samples/AE/AS/startWASService.sh 1.1 # # Licensed Materials - Property of IBM # # COPYRIGHT International Business Machines Corp. 2008,2009 # All Rights Reserved # # US Government Users Restricted Rights - Use, duplication or # disclosure restricted by GSA ADP Schedule Contract with IBM Corp. # # IBM_PROLOG_END_TAG # @(#)43 1.1 src/bos/usr/lpp/bosinst/samples/AE/AS/startWASService.sh, bosinst, bos720 3/29/09 15:20:32 # # A utility for config WAS. # # usage: sh startWASService # source include for debug output . /opt/IBM/AE/AS/debugWAS WAS=/opt/IBM/WebSphere WAS_HOME=$WAS/AppServer WAS_PROFILES=$WAS/Profiles touch $CONFIGWAS7/.started createWASService() { echodebug "Creating WAS Service: $autostart" echodebug "Profile Name: $PROF_NAME" echodebug "Server Name: $SERVER_NAME" # purposely running as root # This JUST creates the service it does not start it /opt/IBM/WebSphere/AppServer/bin/wasservice.sh -add $PROF_NAME -servername $SERVER_NAME -profilePath /opt/IBM/WebSphere/Profiles/$PROF_NAME -userid virtuser echodebug "Resetting chown/chgrp" chown -R virtuser /opt/IBM/WebSphere/Profiles/$PROF_NAME chgrp -R $WASGROUP /opt/IBM/WebSphere/Profiles/$PROF_NAME } createAndStartWASService() { if [ "$UNAME" = "AIX" ] then mkitab "startWAS:2:once:/opt/IBM/WebSphere/AppServer/bin/startServer.sh $SERVER_NAME -profileName $PROF_NAME" /opt/IBM/WebSphere/AppServer/bin/startServer.sh $SERVER_NAME -profileName $PROF_NAME else createWASService /etc/init.d/$PROF_NAME$INIT start fi } echodebug "Starting the WebSphere server process(es)" #WAS_PASSWORD=`cat $WAS_PROFILES/.ibm/password` #WAS_USERNAME=`cat $WAS_PROFILES/.ibm/username` INIT=_was.init cd $WAS_HOME profile_num=0 while [ $# -ne 0 ] do case $1 in -type*) type=$2 ;; -profile_num*) profile_num=$2 ;; -jmgr_register*) jmgr_register=$2 ;; -jmgr_httpport*) jmgr_httpport=$2 ;; *) ;; esac shift 2 done #echo all parameters if [ $type ] ; then echodebug "type=$type" fi if [ $profile_num ] ; then echodebug "profile_num=$profile_num" fi if [ $type == 'adminagent' ] ; then echodebug "Call service to start administrative agent" PROF_NAME=DefaultAdminAgent01 SERVER_NAME=adminagent createWASService # adminagent should have already been started and left running by updateWASProfile # start any app servers defined profile_index=1 while [ $profile_index -le $profile_num ] do echodebug "Start AA0$profile_index" PROF_NAME=DefaultAppSrvAA0$profile_index SERVER_NAME=server1 createAndStartWASService let profile_index=$profile_index+1 done fi if [ $type == 'cell' ] ; then echodebug "Call service to start the cell deployment manager" PROF_NAME=DefaultCellDmgr01 SERVER_NAME=dmgr createAndStartWASService echodebug "Call service to start the cell nodeagent server" PROF_NAME=DefaultCellAppSrv01 SERVER_NAME=nodeagent createAndStartWASService echodebug "Starting the cell application server" # Only one service per node, so we start the nodeagent with the service. # Customer can set server1 to autostart via the nodeagent if [ "$UNAME" = "AIX" ] then su virtuser "-c $WAS_PROFILES/DefaultCellAppSrv01/bin/startServer.sh server1 -trace &" else sudo -u virtuser $WAS_PROFILES/DefaultCellAppSrv01/bin/startServer.sh server1 -trace & fi fi if [ $type == 'custom' ] ; then echodebug "Creating and calling custom service for nodeagent" PROF_NAME=DefaultCustom01 SERVER_NAME=nodeagent createAndStartWASService fi if [ $type == 'default' ] ; then echodebug "Call service to start default application server" PROF_NAME=DefaultAppSrv01 SERVER_NAME=server1 createAndStartWASService fi if [ $type == 'dmgr' ] ; then echodebug "Call service to start the deployment manager" PROF_NAME=DefaultDmgr01 SERVER_NAME=dmgr createAndStartWASService fi if [ $type == 'jmgr' ] ; then echodebug "Call service to start the job manager" PROF_NAME=DefaultJobManager01 SERVER_NAME=jobmgr createAndStartWASService fi echodebug "Done starting the WebSphere server process(es)"