SRCDS Steam group


Run your server as a Service in Windows
#1
This is a relatively easy thing to do, and you don't have to purchase any programs to do it- the old fashioned srvany approach works perfectly. I will now explain in detail what exactly the srvany approach is. Smile

Before we begin, make sure you're starting your server with a batch (.BAT) file, and that it starts in console mode. This will not work any other way. To do this, simply open notepad, and type this into it:

c:
cd\<The Name of the folder in which your srcds.exe resides>
start /high c:\<The Name of the folder in which your srcds.exe resides>\srcds.exe <-vacbeta> -console -game <gametype- such as cstrike for CS:S> +map de_dust2 -maxplayers <However many players you wish to have>

Save this file as "run.bat" in your Source server directory.

Now, on to making the service.

Step 1: Download INSTSRV.EXE and SRVANY.EXE to a directory you can remember on your windows box. For this example, we will put the files in a folder "service" on the root of the C: drive. (C:\service)

The files can be found on my server at the following addresses:
http://counter.tixen.net/runasservice/instsrv.exe
http://counter.tixen.net/runasservice/srvany.exe


Step 2: Open up a dos prompt (click start, run, type "cmd" and hit enter), and go to the directory in which the two files reside (in our example, you would type "cd\service").

Once in the directory, type "INSTSRV SRCDS c:\service\srvany.exe" (of course replacing c:\service with wherever you put the programs). (You can also rename "SRCDS[" with anything you choose- This is the name of the service as it will appear in your list of services.)


Step 3: Close the DOS window by typing EXIT. Now open Regedit (click Start, Run, and typing "Regedit" and press enter). In the folder structure, open the following key:
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\
Scroll down until you find your service, (which we named in our example "SRCDS"). Open this folder as well.



Step 4: On the menu bar for regedit, click on the "edit" menu, and select "new" and "key". a new folder will apear. Name it "Parameters". Open the folder, and add a new string value (click edit, new, string value). A file will appear in the folder. Name it "Application". Then, Right click on "Application", and click "modify".

In the Value data box, type in the path to your Source Server's bat file. In our case, it was the default, so we would type C:\hl2server\run.bat
Then click OK.

Your server is now ready to run as a service! Simply open the services control panel (either in control panel/administrative tools, or just click start, run, and type "services.msc" and hit enter).

You can set when your server starts and other such things from this panel- just find your server in the list.

That's it! Smile

NOTE: Due to the hacked nature of this service setup, stopping the service WILL NOT stop the server. To stop the server manually, simply open up the task manager (CTRL+ALT+DELETE), and find SRCDS.EXE and end the task manually.


Let me know if you have any problems! The files I posted are old versions, but they should still do the trick well enough. Smile
Reply
#2
Question, is it possible to access the console at any time?

I am also using my custom bat file to allow SRCDS.EXE to restart if it closes or crashes.
Reply
#3
DarkZealot89 Wrote:Question, is it possible to access the console at any time?

I am also using my custom bat file to allow SRCDS.EXE to restart if it closes or crashes.

Unfortunately, it is not possible to access the console if it's running as a Service. You're stuck with rcon and logs.

The one downside.

I personally have never had a server crash, but I suppose that failsafe would be good to have. Smile
Reply
#4
I think I will try to run it as a service, but I dont mind having 2 cmd windows open like so:

[Image: 2a1.jpg]

animusic rocks!
Reply
#5
DarkZealot89 Wrote:I think I will try to run it as a service, but I dont mind having 2 cmd windows open like so:
If you don't mind having two windows open, then there's no need to run the server as a service. However, if you like being able to log out of your system without killing your server (or have your server start up with your computer before you log in), Service is the way to go. Smile
Reply
#6
you can use mean server loader as well.. it starts it as a service.. meaning basically it will run the server as soon as the computer starts.. even if the user is not logged in.. meaning you can log in, out.. whatever.. it will always run.. and if the server crashes.. it will automatically restart it.. it works great for me...AND you can acces the console screen. cuz its there.. if you log on.. http://www3.telus.net/mean/mean/04_serverloader.html theres the link.. i think it works great! it will also start up like srcdsfpsbooster at the same time if u want... and will even completly hide that.. cuz theres really no reason to have it open... works really nicely fo me..
Reply
#7
Hmmm im going to look into this a bit more, Services r nice ^^
Reply
#8
I did use your service instructions, however I used them to take the srcdsfps_boost program and have that run in the background. All you have to do is specify the exe of the srcdsfps_boost program INSTEAD of a server .bat file in the registery.
Reply
#9
is there anyway i could get a .bat file or service program that would shut down the server without asking if i wanted to shut it down,then reboot later?

Thanks,
BuIIeT
[Image: brutalhonesty.png]
[Image: STEAM_0:0:16227482_tf2.png]
Reply
#10
im pretty sure serverchecker does something like that, you can set a time to shut the server down, and time to start it back up.
http://www.dumbclan.co.uk/downloads/serverchecker/index.html

and to get it to not ask if you want to shut it down or not.. all you have to do is run the server in console mode.
Reply
#11
You can also run any programs as windows service with this free program. It is easy install and do not require any hacking skills:

Download Guardian Gnome at http://www.jafit.com/portal/desktops/jafit/products.aspx

br,
Rumble
Reply
#12
solei Wrote:This is a relatively easy thing to do, and you don't have to purchase any programs to do it- the old fashioned srvany approach works perfectly. I will now explain in detail what exactly the srvany approach is. Smile

Before we begin, make sure you're starting your server with a batch (.BAT) file, and that it starts in console mode. This will not work any other way. To do this, simply open notepad, and type this into it:

c:
cd\<The Name of the folder in which your srcds.exe resides>
start /high c:\<The Name of the folder in which your srcds.exe resides>\srcds.exe <-vacbeta> -console -game <gametype- such as cstrike for CS:S> +map de_dust2 -maxplayers <However many players you wish to have>

Save this file as "run.bat" in your Source server directory.

Now, on to making the service.

Step 1: Download INSTSRV.EXE and SRVANY.EXE to a directory you can remember on your windows box. For this example, we will put the files in a folder "service" on the root of the C: drive. (C:\service)

The files can be found on my server at the following addresses:
http://counter.tixen.net/runasservice/instsrv.exe
http://counter.tixen.net/runasservice/srvany.exe


Step 2: Open up a dos prompt (click start, run, type "cmd" and hit enter), and go to the directory in which the two files reside (in our example, you would type "cd\service").

Once in the directory, type "INSTSRV SRCDS c:\service\srvany.exe" (of course replacing c:\service with wherever you put the programs). (You can also rename "SRCDS[" with anything you choose- This is the name of the service as it will appear in your list of services.)


Step 3: Close the DOS window by typing EXIT. Now open Regedit (click Start, Run, and typing "Regedit" and press enter). In the folder structure, open the following key:
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\
Scroll down until you find your service, (which we named in our example "SRCDS"). Open this folder as well.



Step 4: On the menu bar for regedit, click on the "edit" menu, and select "new" and "key". a new folder will apear. Name it "Parameters". Open the folder, and add a new string value (click edit, new, string value). A file will appear in the folder. Name it "Application". Then, Right click on "Application", and click "modify".

In the Value data box, type in the path to your Source Server's bat file. In our case, it was the default, so we would type C:\hl2server\run.bat
Then click OK.

Your server is now ready to run as a service! Simply open the services control panel (either in control panel/administrative tools, or just click start, run, and type "services.msc" and hit enter).

You can set when your server starts and other such things from this panel- just find your server in the list.

That's it! Smile

NOTE: Due to the hacked nature of this service setup, stopping the service WILL NOT stop the server. To stop the server manually, simply open up the task manager (CTRL+ALT+DELETE), and find SRCDS.EXE and end the task manually.


Let me know if you have any problems! The files I posted are old versions, but they should still do the trick well enough. Smile

you don't need to set the bat.

just type

instsrv srcds disk/path/srvany.exe

and then regedit

srcds / parameters key
add 3 strings.

application
appdirectory
appparameters

where application is disk/path/srcds.exe
appdirectory disk/path
apparameters -console -game cstrike -tickrate 100 -map de_dust2 -port 1337

etc,etc, etc

this way you dont need to ctrl+alt+del, u can just cmd: net stop srcds net start srcds.

W
Reply
#13
I know this is an old thread, but there is a simple batch file to restart this hacked service:

@echo off
TASKKILL /f /im "srcds.exe"
net stop SERVICE NAME
net start SERVICE NAME

paste that into notepad and save as restart.bat
It needs to be run as administrator to work
Reply
#14
Hey ladies Wink,

Was wondering if people are using this method for Windows Server 2008 or something different?

I'd like to know really if just fine to use this method or any improved such manner.

Thanks in advance.
[Image: MJRNUT-1.jpg]
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)