Running Hlds.exe As A Service
BakaBaka
Join Date: 2003-08-13 Member: 19668Members
<div class="IPBDescription">newbie server admin</div> This is my first time trying to run a dedicated server. Everything installed correctly. My question is, how do you guys run the server? If I log off, the server closes. I'm connecting to the server using remot desktop. If I close my session but stay logged in, the server runs fine. But I don't like leaving my account open like that. Is there a way to run the server as a service or daemon? I'm running it on Windows 2003 with NS 2.0 and hlds.exe v4.1.1.1d. Thanks.
Comments
I suggest getting serverdoc. You can start the program in tsclient/tsweb (thats what I assume your using), then just disconnect (dont log off). This will keep it running even if it crashes (it will restart).
<a href='http://www.serverdoc.com/' target='_blank'>http://www.serverdoc.com/</a>
If you need any specific help, let me know.
Now - caveats: I have no idea if this will actually work with HLDS. It *will* create a service and you will be able to set startup type to auto and load the service. Depending on how HLDS is written and its exit code though, it may refuse to load properly, may hang, or may not want to run non-interactively. Only testing will tell.
Some extra notes - the service name is best entered as 8 characters long (and must not be reserved characters like *\&% and so on). The display name can be 256 characters and is what shows up in the service control manager. To uninstall a service, open regedit and delete:
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\(your servicename here)
then reboot.
Let me know if you have questions or how this works for you guys. I may not be home tonight as we stamp out te remainder of Blaster.worm in 500 remote bank branches, but I'll try to pop my head back in here...
Oh well. I have no idea why they wouldn't make that work properly as a service, as all it does is operate basically like a crappy service. Thanks for giving it a try.
Hmmm... I wonder. Maybe I could write a wrapper for the hlds.exe that had proper service architecture. I'll take a look at this when I get home and have some time to look deeper.
This means I can run a HLDS NS server on my mate's computer at college without him knowing about it. Hehe.
--Scythe--
I promise to look into this in the next day or two. Still in the office right now.
just playin Mons <!--emo&:p--><img src='http://www.unknownworlds.com/forums/html/emoticons/tounge.gif' border='0' style='vertical-align:middle' alt='tounge.gif'><!--endemo-->
/me wonders why theres no free apps like Firedaemon Pro...
Save this file to it's own directory. Then run the service installer to install it. Then open regedit, navigate to your new service:
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\(your servicename here)
And on the key where it says 'Imagepath='(the executable path you had specified when you installed the service), add the following:
The path to your hlds.exe AND the parameters you want to include with your hlds.exe IN QUOTES (this is miportant, in the proof of concept version).
So an example would be: c:\sierra\half-life\hlds.exe "-game ns map ns_veil -maxplayers 16"
Close regedit, and try and start your new service. Tell me how it goes (I have no access to hlds here and can;t test this at all, but if you tell me about your errors I can probably figure it out. Or I may give you a debug version).
New service installer please.
C:\Sierra\Counter-Strike\hlds.exe "-game ns -map ns_caged -maxplayers 8"
and with the interact with desktop set the HLDS window opens up and I get a Fatal HLDS error
Fatal Error (shutting down) W_LoadWadFile: Couldn't Load gfx.wad
Its the same HLDS.exe that I use when I manually start the server. So I dont know why all of the sudden it can't find the gfx.wad. (I can still start it manually)
Don't let this drive you madd. It would be cool to have but I can live without it. I just offered to help since no one else was testing it.
Ok, let me think on this a bit. Has to be something we can do...
Any luck?
--Scythe--
<a href='http://www3.telus.net/mean/mean/04_serverloader.html' target='_blank'>http://www3.telus.net/mean/mean/04_serverloader.html</a>
<!--QuoteBegin--></span><table border='0' align='center' width='95%' cellpadding='3' cellspacing='1'><tr><td><b>QUOTE</b> </td></tr><tr><td id='QUOTE'><!--QuoteEBegin-->The (mEAn) ServerLoader will load up your HLDS server as a windows service. It can also be configured to load up other programs as a service, such as HLTV or any other program that normally does not run as a service. It will monitor each loaded service for failures and automatically restart them for you. It will allow you to log out of your Windows session without taking down the service. In addition, it will automatically restart your services whenever your server reboots - no manual intervention is needed! Works on Win2K and XP servers.
* Automatically loads up your services on server start up and after unexpected restarts.
Gives your server unattended 24/7 uptime by automatically restarting your services after failure.
* Low profile installation, requires very little space and no registry settings.
* Consumes negligible amounts of memory and CPU time.
Simple command-line interface designed for server operators.<!--QuoteEnd--></td></tr></table><span class='postcolor'><!--QuoteEEnd-->
Now if only he had posted source I could see why HLDS seems to hate the wrapper environment of my little EXE. Oh well, someone try this out and tell us how it went.