Running Hlds.exe As A Service

BakaBakaBakaBaka Members Join Date: 2003-08-13 Member: 19668Posts: 11
newbie server admin
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.
A Metal Slime draws near...

Comments

  • DihardDihard Members, Constellation Join Date: 2002-12-02 Member: 10365Posts: 300 Advanced user
    There's a guide to running [email protected] as a server here (found with google). The directions should generally be the same but replace everything with hlds instead. I also remember a program that allowed you to set programs to run as services, but I can't remember what it's called...
    image
  • ZdroneZdrone Members, Constellation Join Date: 2002-11-02 Member: 3914Posts: 167
    I think Dihard is thinking of Firedaemon?

    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).

    http://www.serverdoc.com/

    If you need any specific help, let me know.

  • MonsieurEvilMonsieurEvil Members, Retired Developer, NS1 Playtester, Contributor Join Date: 2002-01-22 Member: 4Posts: 8,282
    Do you have access to the Windows NT or 2000 resource kits? You could use the srvany.exe to try and run HLDS as a service. Based on how HLDS is designed to run (a non-terminating process), it should have no problem working that way theoretically. If you do not have access to that, I will post up a similar utility I wrote some time ago (when I get to work).
    msleeper: "I'm not a huge fan of the new CC design. The old one felt like a race car into the future. This one is just a giant steel coffin with a built in TV."

    Chris0132: "Dunno I kinda want my own titanium pneumaytic stabilised doom cubicle. Kinda wish you could upgrade it though so it can stomp around on the hydraulics and shout anti-communist propaganda at the aliens."
  • MonsieurEvilMonsieurEvil Members, Retired Developer, NS1 Playtester, Contributor Join Date: 2002-01-22 Member: 4Posts: 8,282
    edited August 2003
    Finally broke free to make a quick new version of this (couldn't find my old one to save my life, but oh well). This is a compiled script done in WIL 2003G (i.e. 'Winbatch'). It self extracts 2 DLL's to run, so all you need to is to copy the exe somewhere, execute it, and answer its questions. It will then create the service entries to make your EXE run as a service. This will work on XP and 2000 (and technically NT4 too, although it will give you a benign error at the very end which I was frankly too lazy to fix).

    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...
    ssi.exe 641.4K
    msleeper: "I'm not a huge fan of the new CC design. The old one felt like a race car into the future. This one is just a giant steel coffin with a built in TV."

    Chris0132: "Dunno I kinda want my own titanium pneumaytic stabilised doom cubicle. Kinda wish you could upgrade it though so it can stomp around on the hydraulics and shout anti-communist propaganda at the aliens."
  • BakaBakaBakaBaka Members Join Date: 2003-08-13 Member: 19668Posts: 11
    MonsieurEvil thanks for that app. I'll give it try as soon as I get off work. Right now we've been using a shared account and just closing the remote desktop window while leaving the server running. Hopefully this will work. I'm still wondering though. What do other server admins do?
    A Metal Slime draws near...
  • MonsieurEvilMonsieurEvil Members, Retired Developer, NS1 Playtester, Contributor Join Date: 2002-01-22 Member: 4Posts: 8,282
    Did anyone ever try this?
    msleeper: "I'm not a huge fan of the new CC design. The old one felt like a race car into the future. This one is just a giant steel coffin with a built in TV."

    Chris0132: "Dunno I kinda want my own titanium pneumaytic stabilised doom cubicle. Kinda wish you could upgrade it though so it can stomp around on the hydraulics and shout anti-communist propaganda at the aliens."
  • DFA_HaploDFA_Haplo Members Join Date: 2003-01-21 Member: 12537Posts: 160
    I tried on Windows XP Pro. I Keep getting an error 1053 somthing about service did not respond in a timely enough fashion.
    It only takes one idiot to ruin it for everyone. Please stop being that idiot!

    user posted image

    Halls Of Armageddon 3.0 B4
    69.93.219.206:27015 Central Server

  • MonsieurEvilMonsieurEvil Members, Retired Developer, NS1 Playtester, Contributor Join Date: 2002-01-22 Member: 4Posts: 8,282
    edited August 2003
    /me shakes fist at HLDS.exe programmer for not writing his app to load as a service properly...

    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.
    msleeper: "I'm not a huge fan of the new CC design. The old one felt like a race car into the future. This one is just a giant steel coffin with a built in TV."

    Chris0132: "Dunno I kinda want my own titanium pneumaytic stabilised doom cubicle. Kinda wish you could upgrade it though so it can stomp around on the hydraulics and shout anti-communist propaganda at the aliens."
  • DFA_HaploDFA_Haplo Members Join Date: 2003-01-21 Member: 12537Posts: 160
    Oh, not that it should matter too too much but Im running the old HLDS. I havent tried any of the new HLDS' patches or new ones for that matter.
    It only takes one idiot to ruin it for everyone. Please stop being that idiot!

    user posted image

    Halls Of Armageddon 3.0 B4
    69.93.219.206:27015 Central Server

  • ScytheScythe NS1 Playtester, Forum Moderators, Constellation, Reinforced - Silver Join Date: 2002-01-25 Member: 46Posts: 4,372 mod
    This sounds like a bloodygood idea MonsE!! GOGOGO! You can make it work! We know you can!

    This means I can run a HLDS NS server on my mate's computer at college without him knowing about it. Hehe.

    --Scythe--
    image
    "Show me an operation that is running smoothly and I'll show you someone who's covering up mistakes. Real boats rock." - Frank Herbert
    image PAPT
  • MonsieurEvilMonsieurEvil Members, Retired Developer, NS1 Playtester, Contributor Join Date: 2002-01-22 Member: 4Posts: 8,282
    Someday... someday I will actually be home... biggrin.gif

    I promise to look into this in the next day or two. Still in the office right now.
    msleeper: "I'm not a huge fan of the new CC design. The old one felt like a race car into the future. This one is just a giant steel coffin with a built in TV."

    Chris0132: "Dunno I kinda want my own titanium pneumaytic stabilised doom cubicle. Kinda wish you could upgrade it though so it can stomp around on the hydraulics and shout anti-communist propaganda at the aliens."
  • DFA_HaploDFA_Haplo Members Join Date: 2003-01-21 Member: 12537Posts: 160
    Is it someday yet?

    just playin Mons tounge.gif
    It only takes one idiot to ruin it for everyone. Please stop being that idiot!

    user posted image

    Halls Of Armageddon 3.0 B4
    69.93.219.206:27015 Central Server

  • MonsieurEvilMonsieurEvil Members, Retired Developer, NS1 Playtester, Contributor Join Date: 2002-01-22 Member: 4Posts: 8,282
    Heh. I should be home at a decent hour tonight, and will take a couple minutes to look into this.
    msleeper: "I'm not a huge fan of the new CC design. The old one felt like a race car into the future. This one is just a giant steel coffin with a built in TV."

    Chris0132: "Dunno I kinda want my own titanium pneumaytic stabilised doom cubicle. Kinda wish you could upgrade it though so it can stomp around on the hydraulics and shout anti-communist propaganda at the aliens."
  • BonelessBoneless Members Join Date: 2002-09-03 Member: 1270Posts: 219
    I use Firedaemon Lite (1 service limitation) since I run a single server... and works like a charm... The problem comes out if you run more than one server on the same hardware, you will need Firedaemon Pro which costs $€$€...

    /me wonders why theres no free apps like Firedaemon Pro...
  • MonsieurEvilMonsieurEvil Members, Retired Developer, NS1 Playtester, Contributor Join Date: 2002-01-22 Member: 4Posts: 8,282
    Ok, so here's a goofy little proof of concept wrapper (I don;t feel like working today, if you haven't noticed). Now, this is just a small proof of concept and is very dirty (you will need to make a couple registry edits for it to work, so if you are incompetent or easily scared - run away!).

    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).



    msleeper: "I'm not a huge fan of the new CC design. The old one felt like a race car into the future. This one is just a giant steel coffin with a built in TV."

    Chris0132: "Dunno I kinda want my own titanium pneumaytic stabilised doom cubicle. Kinda wish you could upgrade it though so it can stomp around on the hydraulics and shout anti-communist propaganda at the aliens."
  • MonsieurEvilMonsieurEvil Members, Retired Developer, NS1 Playtester, Contributor Join Date: 2002-01-22 Member: 4Posts: 8,282
    edited August 2003
    Also (Important!) - redownload the service installer - it had a mask set on the extension of exe, and this service wrapper must end with exs. Just overwrite your old service installer.
    Post edited by Unknown User on
    ssi.exe 641.4K
    msleeper: "I'm not a huge fan of the new CC design. The old one felt like a race car into the future. This one is just a giant steel coffin with a built in TV."

    Chris0132: "Dunno I kinda want my own titanium pneumaytic stabilised doom cubicle. Kinda wish you could upgrade it though so it can stomp around on the hydraulics and shout anti-communist propaganda at the aliens."
  • DFA_HaploDFA_Haplo Members Join Date: 2003-01-21 Member: 12537Posts: 160
    Great I'll give this a try when I get home. Thanks.
    It only takes one idiot to ruin it for everyone. Please stop being that idiot!

    user posted image

    Halls Of Armageddon 3.0 B4
    69.93.219.206:27015 Central Server

  • DFA_HaploDFA_Haplo Members Join Date: 2003-01-21 Member: 12537Posts: 160
    edited August 2003
    MEH... The service installer still only shows exe extention files. I even downloaded it twice just to make sure. I tried changing the hldsservc.exs to .exe and that was a no go . *edit * meaning that the service still wouldnt start.*

    New service installer please.
    It only takes one idiot to ruin it for everyone. Please stop being that idiot!

    user posted image

    Halls Of Armageddon 3.0 B4
    69.93.219.206:27015 Central Server

  • MonsieurEvilMonsieurEvil Members, Retired Developer, NS1 Playtester, Contributor Join Date: 2002-01-22 Member: 4Posts: 8,282
    edited August 2003
    darnit I'm a dope. Here you go - the proper service installer. This one correctly shows EX* extensions and will allow you to install the wrapper service correctly.
    ssi.exe 641.4K
    msleeper: "I'm not a huge fan of the new CC design. The old one felt like a race car into the future. This one is just a giant steel coffin with a built in TV."

    Chris0132: "Dunno I kinda want my own titanium pneumaytic stabilised doom cubicle. Kinda wish you could upgrade it though so it can stomp around on the hydraulics and shout anti-communist propaganda at the aliens."
  • DFA_HaploDFA_Haplo Members Join Date: 2003-01-21 Member: 12537Posts: 160
    Well doing a little better. The service pretends like it starts it even says its started but you cannot connect to the server and I can even start another HLDS server manually and it dosent error out telling me the port is already in use. I wish there was some way to view the output of the service to see what exactly its doing.
    It only takes one idiot to ruin it for everyone. Please stop being that idiot!

    user posted image

    Halls Of Armageddon 3.0 B4
    69.93.219.206:27015 Central Server

  • MonsieurEvilMonsieurEvil Members, Retired Developer, NS1 Playtester, Contributor Join Date: 2002-01-22 Member: 4Posts: 8,282
    edited August 2003
    What's your HLDS commandline set to in the service? Also, when you load the hlds service, does it show the hlds.exe running in memory (in task mangler)? Also, what happens when you se the service Log on mode to 'allow to interact with desktop'? how about if you provide actual credentials rather than the service account?
    msleeper: "I'm not a huge fan of the new CC design. The old one felt like a race car into the future. This one is just a giant steel coffin with a built in TV."

    Chris0132: "Dunno I kinda want my own titanium pneumaytic stabilised doom cubicle. Kinda wish you could upgrade it though so it can stomp around on the hydraulics and shout anti-communist propaganda at the aliens."
  • DFA_HaploDFA_Haplo Members Join Date: 2003-01-21 Member: 12537Posts: 160
    Ok now I'm the dope and an idiot that can't follow directions very well. I missed the part in the registry about the image path pointing to the hlds.exe. I was too busy adding the parameters. Which now it looks like this
    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.
    It only takes one idiot to ruin it for everyone. Please stop being that idiot!

    user posted image

    Halls Of Armageddon 3.0 B4
    69.93.219.206:27015 Central Server

  • MonsieurEvilMonsieurEvil Members, Retired Developer, NS1 Playtester, Contributor Join Date: 2002-01-22 Member: 4Posts: 8,282
    Ahhhh, I know exactly what that might be! Let me give you a replacement service wrapper, brb.

    msleeper: "I'm not a huge fan of the new CC design. The old one felt like a race car into the future. This one is just a giant steel coffin with a built in TV."

    Chris0132: "Dunno I kinda want my own titanium pneumaytic stabilised doom cubicle. Kinda wish you could upgrade it though so it can stomp around on the hydraulics and shout anti-communist propaganda at the aliens."
  • MonsieurEvilMonsieurEvil Members, Retired Developer, NS1 Playtester, Contributor Join Date: 2002-01-22 Member: 4Posts: 8,282
    Here, try this one. I use a more advanced run function that supports working directories and such. NT Services get very persnickity about trying to assume the environment at all in called applications. Let me know how it goes!

    msleeper: "I'm not a huge fan of the new CC design. The old one felt like a race car into the future. This one is just a giant steel coffin with a built in TV."

    Chris0132: "Dunno I kinda want my own titanium pneumaytic stabilised doom cubicle. Kinda wish you could upgrade it though so it can stomp around on the hydraulics and shout anti-communist propaganda at the aliens."
  • DFA_HaploDFA_Haplo Members Join Date: 2003-01-21 Member: 12537Posts: 160
    Still didn't like it. Got the same error. I have tried putting the service wrapper in the Dir with HLDS and in its own directory and same error messge both ways.
    It only takes one idiot to ruin it for everyone. Please stop being that idiot!

    user posted image

    Halls Of Armageddon 3.0 B4
    69.93.219.206:27015 Central Server

  • MonsieurEvilMonsieurEvil Members, Retired Developer, NS1 Playtester, Contributor Join Date: 2002-01-22 Member: 4Posts: 8,282
    /me shakes fist at hlds

    Ok, let me think on this a bit. Has to be something we can do...
    msleeper: "I'm not a huge fan of the new CC design. The old one felt like a race car into the future. This one is just a giant steel coffin with a built in TV."

    Chris0132: "Dunno I kinda want my own titanium pneumaytic stabilised doom cubicle. Kinda wish you could upgrade it though so it can stomp around on the hydraulics and shout anti-communist propaganda at the aliens."
  • ScytheScythe NS1 Playtester, Forum Moderators, Constellation, Reinforced - Silver Join Date: 2002-01-25 Member: 46Posts: 4,372 mod
    /me prods MonsE

    Any luck?

    --Scythe--
    image
    "Show me an operation that is running smoothly and I'll show you someone who's covering up mistakes. Real boats rock." - Frank Herbert
    image PAPT
  • FlurzFlurz Members, Constellation Join Date: 2002-11-20 Member: 9428Posts: 8
    Isn't google amazing smile.gif

    http://www3.telus.net/mean/mean/04_serverloader.html

    QUOTE
    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.
  • MonsieurEvilMonsieurEvil Members, Retired Developer, NS1 Playtester, Contributor Join Date: 2002-01-22 Member: 4Posts: 8,282
    I love reinventing the wheel... -_-

    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.
    msleeper: "I'm not a huge fan of the new CC design. The old one felt like a race car into the future. This one is just a giant steel coffin with a built in TV."

    Chris0132: "Dunno I kinda want my own titanium pneumaytic stabilised doom cubicle. Kinda wish you could upgrade it though so it can stomp around on the hydraulics and shout anti-communist propaganda at the aliens."
Sign In or Register to comment.