Restart TM1-Service automatically

Post Reply
Toto
Posts: 71
Joined: Mon Jul 20, 2009 8:52 am
OLAP Product: TM1
Version: 9.5 Build 9.5.00100.2380
Excel Version: 2003

Restart TM1-Service automatically

Post by Toto »

Hello,

for testing purposes I installed a XP server, now I want to stop and restart the tm1-server remotely via a batch-file. In the Cognos docu I read that the netsvc command will not work with XP (I tried it and I agree). The TM1 server is running as a service. Do you have a hint how I can remotely start/stop the server automatically?

Thanks a lot,

Toto
lotsaram
MVP
Posts: 3703
Joined: Fri Mar 13, 2009 11:14 am
OLAP Product: TableManager1
Version: PA 2.0.x
Excel Version: Office 365
Location: Switzerland

Re: Restart TM1-Service automatically

Post by lotsaram »

On Windows XP Net Stop and Net Start commands should work.

Eg. batch file would be
Net Stop "Planning Sample"
Eeyore
Posts: 6
Joined: Wed Mar 04, 2009 9:32 pm
OLAP Product: TM1
Version: 9.0 SP3 64-bit
Excel Version: 2003

Re: Restart TM1-Service automatically

Post by Eeyore »

Net Stop / Net Start work, and so do the equivalent SC commands.

The problem with both of these is that neither of them have a Restart command equivalent to the option in the Services applet, so you have to include a delay in your batch file between the Stop and the Start to allow the server to save and unload:
  • Net Stop "Planning Sample"
    Sleep 120
    Net Start "Planning Sample
If the Start executes before the TM1 service has unloaded it will fail, so the Sleep period needs to be conservative. Or you'd have to poll the status of the service and wait until it was down before continuing (probably doable using SC, but beyond my batch file writing skills).

The best solution I've found was to use Sysinternals free PsService.exe utility to restart the service. Copy it to an executable path on the server and this type of command should work in a batch file.
  • psservice restart "Planning Sample" /accepteula
User avatar
jameswebber
Community Contributor
Posts: 188
Joined: Sun Nov 21, 2010 8:00 pm
OLAP Product: Cognos Express 10
Version: CE 10.1.1
Excel Version: 2010
Location: Wellington, New Zealand
Contact:

Re: Restart TM1-Service automatically

Post by jameswebber »

I have had to change all my services to use a domain user who is also an admin user on the box

Then in my TM1 prolog I can do this:

vCmd = 'net stop "IBM Cognos Express Advisor"';
ExecuteCommand(vCmd,1);

vCmd = 'net start "IBM Cognos Express Advisor"';
ExecuteCommand(vCmd,1);
Post Reply