Creating and deleting services

Ideas and tips for enhancing your TM1 application
Post Reply
User avatar
Martin Ryan
Site Admin
Posts: 1988
Joined: Sat May 10, 2008 9:08 am
OLAP Product: TM1
Version: 10.1
Excel Version: 2010
Location: Wellington, New Zealand
Contact:

Creating and deleting services

Post by Martin Ryan »

Running TM1 as a service rather than an application can be a bit more secure as it's less likely to be stopped by accident. It is also often IT policy to run services where possible as users (with access rights) can control services remotely without using RDP or similar.

You have to dig in the manuals a bit to find how to create services after install, but the basics are straight forward...

Open a command prompt (Start->Run... "cmd") and change directory to the bin folder of where TM1 is installed

e.g.
CD C:\Program Files\Cognos\TM1\Bin

to create a service type:
tm1sd.exe -install "ServiceName" "DataDirectory"

to delete a service type:
tm1sd.exe -remove -n "ServiceName"

Note that when TM1 runs as a service it will automatically save changes to disk when the server is stopped and it will also load any unsaved logged information in the tm1s.log file on start. Both of these are questions put to the user when running as an application. This can be a good thing it prevents you accidently not saving a lot of data, but if you want control over the write to disk you should use an application.
Last edited by Martin Ryan on Tue Mar 20, 2012 12:06 am, edited 3 times in total.
Reason: Removed redundant switches as pointed out by another user
User avatar
Martin Ryan
Site Admin
Posts: 1988
Joined: Sat May 10, 2008 9:08 am
OLAP Product: TM1
Version: 10.1
Excel Version: 2010
Location: Wellington, New Zealand
Contact:

Re: Creating and deleting services

Post by Martin Ryan »

Another nice thing about running TM1 as a service, rather than as an application, is that you can use TM1 to restart itself, via a batch file.

Create a batch (*.bat) file on the server box in a directory accessible by TI (usually easiest to put it in the data directory) and insert the following two lines into it

Code: Select all

net stop <servicename>
net start <servicename>
You can then use the ExecuteProcess command in the epilog of a TI process, e.g.

Code: Select all

EXECUTECOMMAND('<path to database directory>\RESTART.BAT',0); 
This can be useful, for example, if you don't have easy access to the development server and you need to restart it frequently for testing purposes. It is also a crude, though sometimes effective, way of managing models that frequently hit RAM limits.
ScottW
Regular Participant
Posts: 152
Joined: Fri May 23, 2008 12:08 am
OLAP Product: TM1 CX
Version: 9.5 9.4.1 9.1.4 9.0 8.4
Excel Version: 2003 2007
Location: Melbourne, Australia
Contact:

Re: Creating and deleting services

Post by ScottW »

Actually if the batch file is in the data directory then all that is required is

Code: Select all

EXECUTECOMMAND('RESTART.BAT',0);
as the default directory path that TI assumes is the database directory.
Cheers,
Scott W
Cubewise
www.cubewise.com
frosterrj
Posts: 17
Joined: Tue Jun 17, 2008 10:44 pm
OLAP Product: TM1 9.1.4 64-bit
Version: Olap Objects and TM1 Web
Excel Version: 2003
Location: Seattle, WA; Oakland, CA

Re: Creating and deleting services

Post by frosterrj »

One thing I might add is that you might need the MS Resource kit tools (rktools.exe) to get the 'sleep' command to stop the process from trying to restart before it has finished writing to disk.

Using 64-bit TM1, the write-down takes some what longer after the nightly chores finish running. We've run into problems where the service failed to restart and users were left without Tm1 availability.

Our batch looks like your net stop/net start but has sleep -x seconds between to allow the write to disk to complete.

So far works like a charm.
User avatar
Martin Ryan
Site Admin
Posts: 1988
Joined: Sat May 10, 2008 9:08 am
OLAP Product: TM1
Version: 10.1
Excel Version: 2010
Location: Wellington, New Zealand
Contact:

Re: Creating and deleting services

Post by Martin Ryan »

As pointed out by Herman in the main forum...

Installing a TM1 service in 9.5 has changed slightly.....

Historically you would need to write the following code in Command Prompt world

TM1sd.exe -install TM1Server "c:\Dev\Tm1server"

NOW IN 9.5

TM1sd.exe -install -n TM1Server -z "c:\Dev\Tm1server"

It has new parameters of -n and -z that was not needed before (or not aware of) in the command prompt.

Examine this in the Operations Guide.
Please do not send technical questions via private message or email. Post them in the forum where you'll probably get a faster reply, and everyone can benefit from the answers.
Jodi Ryan Family Lawyer
User avatar
Alan Kirk
Site Admin
Posts: 6606
Joined: Sun May 11, 2008 2:30 am
OLAP Product: TM1
Version: PA2.0.9.18 Classic NO PAW!
Excel Version: 2013 and Office 365
Location: Sydney, Australia
Contact:

Re: Creating and deleting services

Post by Alan Kirk »

Martin Ryan wrote:As pointed out by Herman in the main forum...

Installing a TM1 service in 9.5 has changed slightly.....

Historically you would need to write the following code in Command Prompt world

TM1sd.exe -install TM1Server "c:\Dev\Tm1server"

NOW IN 9.5

TM1sd.exe -install -n TM1Server -z "c:\Dev\Tm1server"

It has new parameters of -n and -z that was not needed before (or not aware of) in the command prompt.

Examine this in the Operations Guide.
Wise users who followed my "How To" guide always used these anyway. :D
I wrote:My preference is to pass the parameter flags (eg, -n) as well as the parameters themselves (eg ProdServer) when installing a service
"To them, equipment failure is terrifying. To me, it’s 'Tuesday.' "
-----------
Before posting, please check the documentation, the FAQ, the Search function and FOR THE LOVE OF GLUB the Request Guidelines.
Post Reply