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

Author Topic: script to stop services, reboot servers, and start services in appropriate order  (Read 19253 times)

Offline jagadeeshgelivi

  • Associate
  • **
  • Join Date: Mar 2023
  • Posts: 3
  • Forum Citizenship: +0/-0
Hi jeffowentn, The links which you have attached are not working now. Can you please provide me the links again.

Thanks in Advance

Offline dougp

  • Statesman
  • ******
  • Join Date: Jul 2014
  • Posts: 868
  • Forum Citizenship: +30/-1
Is this the same question?

This seems like an odd question.  Is Cognos really that fragile?  I would expect you can start the services in any order and they would wait and check again if dependencies are not yet running.

Telling us what version of Cognos and what operating system you are using would be helpful.

I see batch calls in this thread, so I'll assume you are running Cognos on Windows.  I recommend using PowerShell.

Rebooting the machine will stop the services.  The order in which you stop services should not matter.  What may matter is what order services start (and complete starting).

To start the services in a specific order, you'll want to determine the proper order and build delays and waits into your process.  This script starts the IBM Cognos service, waits for it to start, then returns the new entries in cognosserver.log.

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

I run this from a different computer as an account that has admin privileges on the server.  You can see my Cognos install is on the E: drive and I'm using the E$ admin share.  I left that in to demonstrate escaping the $.  I could very well have simply shared the logs folder.

And I'm running Cognos Analytics, but I would expect this process for Cognos Planning would be similar.