If you are unable to create a new account, please email support@bspsoftware.com

 

News:

MetaManager - Administrative Tools for IBM Cognos
Pricing starting at $2,100
Download Now    Learn More

Main Menu

Stopping and starting Cognos...

Started by Vinyljunkie, 18 Nov 2024 11:24:27 AM

Previous topic - Next topic

Vinyljunkie

I help administer several farms of Cognos servers on Windows servers and automation through scripts is key to managing them effectively and efficiently.

IBM have recently told us that we shouldn't be using stop-service and start-service commands to stop and start the services and that they "recommend stopping and starting services using Cognos Configuration buttons, and expand the details to see any associated errors."  We are also cleaning up orphaned processes after shutting Cognos down.

We already have both script and log file monitoring - so unless they are outputting errors to the screen only (and I wouldn't put it past IBM to do so) I can't see the benefit unless it is a hidden one. 

So the big questions are:
Is IBM talking out of their derriere and we can ignore them?
Is it going to be doing extra bits and pieces we don't know about if we use the configuration buttons to stop and start Cognos?
Do others here use scripts for stopping and starting their Cognos services on Windows and do you have issues with restarting?

Thanks in advance.

dougp

Sounds like nonsense to me.  But you do need to wait until the service has stopped before starting it again.

Also running on Windows Server, here's something like what I do.  This stops the service, waits to be sure the service has stopped, displays the end of cognosserver.log (so -- details to see any associated errors), (optionally, so something here), starts the service, waits to be sure the service has started, displays the end of cognosserver.log.  The log tail can be dumped to a different log file (instead of printed to the screen) so it's headless and you need only look at the shutdown and startup stuff, rather than needing to sift through thousands of lines of user activity if something went wrong.

This is a basic concept I just grabbed from my notes.  I have several scripts that use similar code to perform actual tasks.  And I don't remember if this was for PowerShell 5 or 7.  (What I'm saying here is that I never run exactly this code.  It may not work.  And since there's no chance your environment exactly matches mine, your mileage may vary.  Use at your own risk.  No warranty expressed or implied.)

# PowerShell

## Stop service

    $servername = "supersecretcomputername"
    $servicename = "IBM Cognos"
    $coglog = "\\$servername\c`$\Program Files\ibm\cognos\analytics\logs\cognosserver.log"
   
    $linesbefore = (Get-Content $coglog | Measure-Object –Line).Lines
    $cogsvc = Get-Service -ComputerName $servername -Name $servicename
    $cogsvc.Stop()
    "Waiting for the $servicename service on $servername to stop."
    $cogsvc.WaitForStatus("Stopped")
    "The $servicename service on $servername is stopped."
    $linesafter = (Get-Content $coglog | Measure-Object –Line).Lines
    $len = $linesafter - $linesbefore
    Get-Content -Path $coglog -Tail $len

## Do something here


## Start service

    # $servername = "supersecretcomputername"
    # $servicename = "IBM Cognos"
    # $coglog = "\\$servername\c`$\Program Files\ibm\cognos\analytics\logs\cognosserver.log"
   
    $linesbefore = (Get-Content $coglog | Measure-Object –Line).Lines
    # $cogsvc = Get-Service -ComputerName $servername -Name $servicename
    $cogsvc.Start()
    "Waiting for the $servicename service on $servername to start."
    $cogsvc.WaitForStatus("Running")
    "The $servicename service on $servername is running."
    $linesafter = (Get-Content $coglog | Measure-Object –Line).Lines
    $len = $linesafter - $linesbefore
    Get-Content -Path $coglog -Tail $len


Vinyljunkie

#2
Thanks for your response @dougp - greatly appreciated - our script is (unsurprisingly) quite similar.

We have a sleep of 10 seconds in our script after the stop service has finished because we have found that the powershell script is just too quick for it's own good and Windows sometimes lies to us (shocker).

Also we do this to remove any orphaned processes after the processes are "stopped" as we have often found some lingering around, usually java processes, but this definitely gets rid of them:

Get-Process | Where-Object {$_.Path -like '*cognos*'} | stop-process -Force

We don't do any log file monitoring in the script so I'm going to look into it, it seems an interesting approach.

And thanks again.