COGNOiSe.com - The IBM Cognos Community

IBM Cognos 10 Platform => Cognos 10 BI => Cognos Administration => Topic started by: ssing202 on 26 Apr 2012 06:20:22 AM

Title: Script to start and stop cognos 10.1.1 services
Post by: ssing202 on 26 Apr 2012 06:20:22 AM
Hi All,

I have to write a script to stop and start cognos services in sequence like first stop content manger service and start it and then dispatcher service.

I have no idea from where to start about this :-[ , your help will be highly appreciated.

Thanks
Title: Re: Script to start and stop cognos 10.1.1 services
Post by: MFGF on 26 Apr 2012 07:28:07 AM
These services are not explicit Windows services or Unix daemons, but run as components of the Application Server and Content Manager java containers. There is only one service to stop/start, and the rest will all be taken care of. I guess you could separate the processing into separate installs having different services enabled in each, and these would then present as different services you could stop and start from the OS, but why would you want to do this?

Regards,

MF.
Title: Re: Script to start and stop cognos 10.1.1 services
Post by: Grim on 26 Apr 2012 08:32:35 AM
Windows batch...(albeit very basic as I'm not on windows, but you should get the idea.) More batch file info here:
http://www.robvanderwoude.com/parameters.php
and google.com is your friend

if "%1"=="start" goto start
if "%1"=="stop" goto stop
if "%1"=="" echo "Usage: (start | stop)"
:start
net start <service name for cm>
net start <service name for app/disp>
:stop
net stop <service name for app/disp>
net stop <service name for cm>
:end



Unix/Linux...
#!/bin/bash
#-------------------------------------------------------------------------------
#   Cognos Start/Stop script
#-------------------------------------------------------------------------------
# Global Vars
COGNOS_HOME=/usr/ibm/cognos
LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$COGNOS_HOME/cm/bin:$COGNOS_HOME/rs/bin:$COGNOS_HOME/gw/bin
JAVA_HOME=/usr/java/jre1.5.0_12

export JAVA_HOME LD_LIBRARY_PATH

startCognos()
{
        echo $(date '+%Y-%m-%d %H:%M:%S') ":: [START INITIATED]"
        cd ${COGNOS_HOME}

        echo $(date '+%Y-%m-%d %H:%M:%S') ":: Starting CM..."
        ./cm/bin/cogconfig.sh -s
        echo $(date '+%Y-%m-%d %H:%M:%S') ":: CM Started."

        echo $(date '+%Y-%m-%d %H:%M:%S') ":: Starting RS..."
        ./rs/bin/cogconfig.sh -s
        echo $(date '+%Y-%m-%d %H:%M:%S') ":: RS Started."

        echo $(date '+%Y-%m-%d %H:%M:%S') ":: [START COMPLETE] All services are up."
}
stopCognos()
{
        echo $(date '+%Y-%m-%d %H:%M:%S') ":: [STOP INITIATED]"
        cd ${COGNOS_HOME}

        echo $(date '+%Y-%m-%d %H:%M:%S') ":: Stopping RS..."
        ./rs/bin/cogconfig.sh -stop
        echo $(date '+%Y-%m-%d %H:%M:%S') ":: RS Stopped."

        echo $(date '+%Y-%m-%d %H:%M:%S') ":: Stopping CM..."
        ./cm/bin/cogconfig.sh -stop
        echo $(date '+%Y-%m-%d %H:%M:%S') ":: CM Stopped."

        echo $(date '+%Y-%m-%d %H:%M:%S') ":: [STOP COMPLETE] All services are down."
}

case "$1" in
'start')
        startCognos
        ;;
'stop')
        stopCognos
        ;;
'restart')
        stopCognos
        sleep 10
        startCognos
        ;;
*)
        echo "Usage: ${0} { start | stop | restart }"
        ;;
esac
exit
Title: Re: Script to start and stop cognos 10.1.1 services
Post by: ssing202 on 01 May 2012 11:15:53 PM
Thanks for the response.. :)
Sometimes due to some issue cognos services stopped due to which environment become unavailable. Then we have to check all the components of cognos and restart them manually.

I am looking for a script which can check status of the component and ask to start or stop the component accordingly...

Any pointer about it will be really great. If possible can anyone provide me links which will help me in developing scripts.

Thanks.
Title: Re: Script to start and stop cognos 10.1.1 services
Post by: MMcBride on 04 May 2012 02:47:36 PM
ssing202 as MFGF pointed out there is no way to segregate the individual components of a Cognos dispacher the way you are looking for.

Grim, I am betting you are using Tomcat on Unix for your scripts to work.

I have an AIX/WebSphere deployment and I know the "./cogconfig.sh -s" will not stop the Cognos service.
When using WebSphere you need to make the script stop/start the Published app within Websphere so the command itself would be different but the essential script would still work.
Title: Re: Script to start and stop cognos 10.1.1 services
Post by: Grim on 08 Jun 2012 12:35:31 PM
Quote from: MMcBride on 04 May 2012 02:47:36 PM
ssing202 as MFGF pointed out there is no way to segregate the individual components of a Cognos dispacher the way you are looking for.

Grim, I am betting you are using Tomcat on Unix for your scripts to work.

I have an AIX/WebSphere deployment and I know the "./cogconfig.sh -s" will not stop the Cognos service.
When using WebSphere you need to make the script stop/start the Published app within Websphere so the command itself would be different but the essential script would still work.

Correct. For the websphere stuff you could just issue websphere admin commands in the script. If your using Unix and WAS I would assume you know these commands. If not look up the ./wsadmin.sh command stuff in your WAS docs. ;)