Trackmania Server as Windows Service

This is the place where you can find everything related to the dedicated server, control scripts and community tools.

Moderators: Pit Crew, TM-Patrol

Post Reply
Scordo
cyclist
cyclist
Posts: 46
Joined: 01 Feb 2009 00:22
Owned TM-games: TMU

Trackmania Server as Windows Service

Post by Scordo » 16 Jul 2009 17:50

Hello Server-Owners,

during development of TMSPS I've created a windows service which enables you to run the trackmania dedicated server under windows as a windows service. First I wrote it for my personal use, but I think most of the windows server owners will need it. So I've created a release today. You can download it here:

http://tmsps.codeplex.com/Release/Proje ... seId=30257

Description:
The Trackmania Service Wrapper is a wrapper service for the trackmania dedicated server software. It allows you to run the trackmania dedicated server software as a windows service.

Requirements:
  • .Net 3.5

Advantage
  • auto restart of crashed trackmania server
  • possibility to provide a web frontend to start/stop the service (already developed but no release currently)
I've already written an ASP.Net web frontent to start/stop the trackmania server using the browser, but there is no documentation on how to install it. That's why it isn't released yet. But I'll hopefully release it within the next week.

Suggestions/Criticism/Feedback is welcome!
Scordo
Debuggers don't remove bugs, they only show them in slow motion

>> Help me and contribute to: TMSPS <<

matzi
happy cruiser
happy cruiser
Posts: 161
Joined: 20 Aug 2008 14:52
Owned TM-games: TMO TMN TMU TMF
Location: Austria
Contact:

Re: Trackmania Server as Windows Service

Post by matzi » 16 Jul 2009 21:37

wow
good work, go on :thumbsup:

Scordo
cyclist
cyclist
Posts: 46
Joined: 01 Feb 2009 00:22
Owned TM-games: TMU

Re: Trackmania Server as Windows Service

Post by Scordo » 16 Jul 2009 23:49

matzi wrote:wow
good work, go on :thumbsup:
Thanks! :1
Debuggers don't remove bugs, they only show them in slow motion

>> Help me and contribute to: TMSPS <<

Assembler Maniac
Pit Crew
Pit Crew
Posts: 1493
Joined: 03 Jun 2006 13:24
Owned TM-games: TMU
Contact:

Re: Trackmania Server as Windows Service

Post by Assembler Maniac » 17 Jul 2009 05:15

I can write a pretty simple installer that takes the path for TrackmaniaServer.exe (without the filename), and appropriate parms, and turns it into a service.

DOS Command "net start SVCNAME" or "net stop SVCNAME" can be used to start/stop a service fairly easily.

Could probably even prompt for the arguments too.

Anyone interested in this?

No .net needed either.

User avatar
lille79
Pit Crew
Pit Crew
Posts: 881
Joined: 09 Dec 2007 15:04
Owned TM-games: TMN, TMNF, TMUF
Location: Norway
Contact:

Re: Trackmania Server as Windows Service

Post by lille79 » 17 Jul 2009 11:13

Assembler Maniac wrote: Anyone interested in this?
:thumbsup:
/lille79
Old man of the Norwegian Trackmania team Super Sheep Racing
To visit my homepage/blog, and download the usbTMFserver, this is the place to go.

nocturne
solid chaser
solid chaser
Posts: 1390
Joined: 08 Jun 2007 18:48
Owned TM-games: all
Contact:

Re: Trackmania Server as Windows Service

Post by nocturne » 17 Jul 2009 20:07

What about using sc.exe to install as a service..?
sc create [service name] [binPath= ] <option1> <option2>...
CREATE OPTIONS:
NOTE: The option name includes the equal sign.
type= <own|share|interact|kernel|filesys|rec>
(default = own)
start= <boot|system|auto|demand|disabled>
(default = demand)
error= <normal|severe|critical|ignore>
(default = normal)
binPath= <BinaryPathName>
group= <LoadOrderGroup>
tag= <yes|no>
depend= <Dependencies(separated by / (forward slash))>
obj= <AccountName|ObjectName>
(default = LocalSystem)
DisplayName= <display name>
password= <password>
Another nifty little app is XYNTService, which will let you set up a single service to start up multiple process in a specific order with/without timeouts.

User avatar
Generator
speedy pilot
speedy pilot
Posts: 339
Joined: 18 Apr 2008 00:35
Owned TM-games: TMNF - TMUF
Manialink(s): Generator
Location: Lancashire, England
Contact:

Re: Trackmania Server as Windows Service

Post by Generator » 17 Jul 2009 22:15

Assembler Maniac wrote:I can write a pretty simple installer that takes the path for TrackmaniaServer.exe (without the filename), and appropriate parms, and turns it into a service.

DOS Command "net start SVCNAME" or "net stop SVCNAME" can be used to start/stop a service fairly easily.

Could probably even prompt for the arguments too.

Anyone interested in this?

No .net needed either.
Do you know about Microsoft's SC command Assembler Maniac? 'SC.exe' can give you alot more options and is dedicated to dealing with services. :thumbsup:

net start/stop is a little bit more limited. :wink:

Code: Select all

DESCRIPTION:
        SC is a command line program used for communicating with the
        Service Control Manager and services.
USAGE:
        sc <server> [command] [service name] <option1> <option2>...


        The option <server> has the form "\\ServerName"
        Further help on commands can be obtained by typing: "sc [command]"
        Commands:
          query-----------Queries the status for a service, or
                          enumerates the status for types of services.
          queryex---------Queries the extended status for a service, or
                          enumerates the status for types of services.
          start-----------Starts a service.
          pause-----------Sends a PAUSE control request to a service.
          interrogate-----Sends an INTERROGATE control request to a service.
          continue--------Sends a CONTINUE control request to a service.
          stop------------Sends a STOP request to a service.
          config----------Changes the configuration of a service (persistent).
          description-----Changes the description of a service.
          failure---------Changes the actions taken by a service upon failure.
          failureflag-----Changes the failure actions flag of a service.
          sidtype---------Changes the service SID type of a service.
          privs-----------Changes the required privileges of a service.
          qc--------------Queries the configuration information for a service.
          qdescription----Queries the description for a service.
          qfailure--------Queries the actions taken by a service upon failure.
          qfailureflag----Queries the failure actions flag of a service.
          qsidtype--------Queries the service SID type of a service.
          qprivs----------Queries the required privileges of a service.
          qtriggerinfo----Queries the trigger parameters of a service.
          qpreferrednode--Queries the preferred NUMA node of a service.
          delete----------Deletes a service (from the registry).
          create----------Creates a service. (adds it to the registry).
          control---------Sends a control to a service.
          sdshow----------Displays a service's security descriptor.
          sdset-----------Sets a service's security descriptor.
          showsid---------Displays the service SID string corresponding to an arbitrary name.
          triggerinfo-----Configures the trigger parameters of a service.
          preferrednode---Sets the preferred NUMA node of a service.
          GetDisplayName--Gets the DisplayName for a service.
          GetKeyName------Gets the ServiceKeyName for a service.
          EnumDepend------Enumerates Service Dependencies.

        The following commands don't require a service name:
        sc <server> <command> <option>
          boot------------(ok | bad) Indicates whether the last boot should
                          be saved as the last-known-good boot configuration
          Lock------------Locks the Service Database
          QueryLock-------Queries the LockStatus for the SCManager Database
EXAMPLE:
        sc start MyService
http://support.microsoft.com/kb/251192


EDIT: Sorry Nocturne, didn't notice the line above the quotes on your post! :oops:
I just saw the 3rd party app recommendation. My Bad...
Customize your virtual world to the max! >> http://www.virtualcustoms.net
3D Models, 2D skins & horns on my Manialink >> Generatorcolor>

nocturne
solid chaser
solid chaser
Posts: 1390
Joined: 08 Jun 2007 18:48
Owned TM-games: all
Contact:

Re: Trackmania Server as Windows Service

Post by nocturne » 17 Jul 2009 23:46

Generator wrote:net start/stop is a little bit more limited. :wink:
Those just start/stop the service, once installed. Easiest route to creating simple restart/stop batch files.

Also, can always just add it by hand to the registry, in case you find yourself lost in long dos commands.

Assembler Maniac
Pit Crew
Pit Crew
Posts: 1493
Joined: 03 Jun 2006 13:24
Owned TM-games: TMU
Contact:

Re: Trackmania Server as Windows Service

Post by Assembler Maniac » 18 Jul 2009 04:52

Batch files would be difficult to use, at best, if you're managing multiple servers. Creating/deleting/starting/stopping would be much easier if there was a simple manager for it.

How about a Delphi app (single EXE, no DLLs required) to manage your TMFServer Services?

I hope to have it done over the weekend.

It will list any servers it finds (TMFServerNN where NN is 00 to 99), it's status (running/stopped), let you start/restart/stop it, and let you create/destroy them. All with ability to pick the startup files (config & matchsettings), and set the LAN and AutoQuit options.

Installer will create desktop shortcut, and install the manager & srvany.exe (necessary to run trackmaniaserver.exe as a service) in the trackmaniaserver directory.

Assembler Maniac
Pit Crew
Pit Crew
Posts: 1493
Joined: 03 Jun 2006 13:24
Owned TM-games: TMU
Contact:

Re: Trackmania Server as Windows Service

Post by Assembler Maniac » 19 Jul 2009 06:17

Unzip http://www.pchotshots.com/amaniac/tmfsvcmgr.zip into your trackmaniaserver.exe directory. You *MUST* use the same directory, otherwise it will NOT work.

nssm.exe is used to actually run the server. (it handles the service calls)

Once you run TMFSvcMgr, you'll see a blank grid. Right click anywhere for the menu.

It should be pretty easy to figure out. After editing an existing server, you'll need to stop/restart to get the changes to take effect.

I'm kinda wiped right now, can some brave person download it and try it out?

Interaction with desktop is turned on at the moment, so you should see the server actually running. I might make this a config option.

Closing the server window (ctrl-break or X) will NOT stop the service - TrackmaniaServer WILL be restarted automatically!

I'll add a readme.txt when I have some time.

[edit] - changed srvany.exe to nssm.exe, made note that killing trackmaniaserver.exe will result in it being restarted.

User avatar
ЭΛ GAS〄SőŁのเē尺
sunday driver
sunday driver
Posts: 55
Joined: 17 Jul 2009 17:37
Owned TM-games: TMU, TMO, TMS ,TMNF
Manialink(s): elteam,or elt for the bored people :P:P

Re: Trackmania Server as Windows Service

Post by ЭΛ GAS〄SőŁのเē尺 » 19 Jul 2009 15:46

Nice! :thumbsup:
Image
ЭΛTEAM SERVERS:
ЭΛ UNITED 80-100K
ЭΛ UNITED PRO 60-90K
ЭΛ CLASSICO 0-60K
ЭΛ MINI RPG 0-50K
ЭΛ PARANIA RPG 0-50k
ЭΛ PRIVE 0-50k (LOCKED)
Enjoy our servers and also visit our Site : http://elteam.ath.cx

Assembler Maniac
Pit Crew
Pit Crew
Posts: 1493
Joined: 03 Jun 2006 13:24
Owned TM-games: TMU
Contact:

Re: Trackmania Server as Windows Service

Post by Assembler Maniac » 19 Jul 2009 15:57

I've made a change.

I found a better program than srvany.exe, it's called NSSM (Non-Sucking Service Manager) and it will restart a server if it crashes out, and it writes helpful events into the application event log (like when it has to restart an app that crashed).

New version avail in same zip file.

Mort
smooth traffic navigator
smooth traffic navigator
Posts: 275
Joined: 16 Jan 2009 10:57
Owned TM-games: TMUF, TMNF
Location: Australia
Contact:

Re: Trackmania Server as Windows Service

Post by Mort » 24 Jul 2009 01:16

Good stuff, I was just about to start testing mine with svrany so this might be a good alternative.

I do have a quesiton though: How does it handle also starting FAST or other server managers as services also?

Assembler Maniac
Pit Crew
Pit Crew
Posts: 1493
Joined: 03 Jun 2006 13:24
Owned TM-games: TMU
Contact:

Re: Trackmania Server as Windows Service

Post by Assembler Maniac » 24 Jul 2009 03:36

Mort wrote:Good stuff, I was just about to start testing mine with svrany so this might be a good alternative.

I do have a quesiton though: How does it handle also starting FAST or other server managers as services also?
Haven't done anything about that yet, but I've been wondering if one service could handle 2 processes. I'll post back if I come up with something. (maybe a custom version of nssm that handles 2 applications)

Post Reply