SRCDS Steam group


Update Question
#1
Does srcds generate any events that Windows can use to trigger certain actions?

Ideally, I'd like to see an event get produced when an update is needed so I can kick off a task to update the game files on the fly.

Currently, I have a low use private server that uses task scheduler to kick off PS scripts I've written to check for updates daily and periodically (every 10 minutes) check to see the srcds.exe is running (and start it if not).

I have to imagine that the big boys who run game servers in mass have a means to detect when updates are needed to kick off updates on all of their servers.
Reply
#2
I think I came up with a solution. I know the code works, but now I need to find out what message is in the log file with Valve sends a command for update. I assumed "update" based on what I recall seeing but I'm not positive at this time.

The solution I came up with is to write one PowerShell script that does the job of checking to ensure the server is up and starts it if not. It then grabs the newest log file (if present) and checks it for "update". If update is present, it stops the server, updates the game, and re-starts the server.

The script runs every 10 minutes, as dictated by Task Scheduler.

If you run srcds on a Windows box, this could be useful. Let me know if you have any problems with it or have suggestions on how it could be improved!

Preregs:
Understand PowerShell
Understand Task Scheduler
Know what all the variables are (you'll see it when you edit the file).


Attached Files
.zip   SourceManager1.zip (Size: 1.28 KB / Downloads: 13)
Reply
#3
I made some minor changes to it today based on some stuff I ran into while continuing to mess around with it.

I also renamed it Fusible Plug.

Here's the updated file.


Attached Files
.zip   Fusible Plug 1.0.2.zip (Size: 1.78 KB / Downloads: 3)
Reply
#4
I feel like I'm talking to a brick wall, but that's alright. Toungue

I've made (for a 100 line script) a LOT of changes. I simplified the number or file paths you have to predefined and added a basic random map option so that the tool won't start the server with the same map EVERY time.

Even if you don't use it, take a look, tell me what you think, and feel free to mess around with it.


Attached Files
.zip   FusiblePlug 1.1.0.zip (Size: 2.59 KB / Downloads: 1)
Reply
#5
Turns out I wasn't looking at the correct log to trigger updates. That's now fixed. Also turns out this was not an original thought as several people, years before me, have done exactly what I've done.

That being said, this tool was written in PowerShell (a first of it's kind from what I can tell) and was created to use Task Scheduler.

I believe it's also the first of it's kind to have a randomize option for the initial start map and have a built in logging feature so you can see when it ran and what it did (both of which can be turned off by flags the admin sets).

I've also included a change log and a basic deployment guide so that people who aren't so familiar with TS or PS can deploy it.

It's been fun. Here it is in it's (hopefully) final form.


Attached Files
.zip   Fusible Plug 2.0.0.zip (Size: 12.58 KB / Downloads: 3)
Reply
#6
oh wow i can't believe no one has taken this one yet... i could really use something like this


i'll run it on my dedi and report back on how it runs Smile

thanks for the contribution


*edit*

just done a quick test of this one my dedi, seems to work quite well but it can't find the logs direcory? can you confirm the following for me:

Code:
$FusiblePlugLogDirectory =

is this the location of my srcsds.exe? or the path above that which contains the orangebox folder?

When i run the script, i see "Log path does not exist!" -

Even though i specify the port: 27011 within your script, when it launches my server it's using 27015?


and finally, is it possible to run multiple servers with this script? - I'm guessing a script for each server instance correct?





Reply
#7
Hey, I'm glad someone finally bit!

1. So $FusiblePlugLogDirectory is where the logs it generates get dumped. So if you give it C:\FusibleLogs and create that directory, it will dump a file called fplog.log in that directory. You have to create that directory manually, it will not make the directory (this is by design, but can be easily added).

2. I never thought about running multiple servers. Currently, it would not be able to tell different instances of srcds.exe running apart. So if you had a TF2 server and a CS:S server and the TF2 server crashed, it would never know. That being said, the update mechanism should still work.

3. The port issue? Hmm.

From line 101-102
Code:
$StartServer = $GameDirectory + " -console -condebug -game " + $GameName + " -hostport " + $HostPort + " +maxplayers " + $MaxPlayers + " +map " + $MapName
Invoke-Expression $StartServer

It should be pulling the port that you declare. Maybe I'm building the command wrong? I'll play with that on my dedicated and see what derpness I've done.


Thanks for the feedback! I'll post back shortly.
Reply
#8
So I fixed the issue with the port. I was using the flag -hostport rather than just -port. I never noticed that because I use 27015. Toungue

I also added a flag for the Logger so you can turn it off. I originally made it so that if the value of $FusiblePlugLogDirectory was 0 it would disable its own logging. I left that but added the option as a flag (meaning you can disable it either way). I'll take the directory conditional check out completely soon.

Also, more on the question of running multiple servers. With some dirty tweaking, it's possible. My way is the hard way (to code) where the admin would create an XML file with the server(s) they wanted to manage and when FusiblePlug ran, it would loop through each of those and check them individually. There's still the complication of how to determine which instance of srcds.exe belongs to which config, and if PowerShell and I are capable of all that, but I like a challenge.


Attached Files
.zip   Fusible Plug 2.0.1.zip (Size: 12.66 KB / Downloads: 1)
Reply
#9
awesome thanks!

as soon as it supports multiple servers i'll start using this Smile
Reply
#10
Does SRCDS Guardian support multiple servers or are there any out there that do already?
Reply
#11
Attached is the new version of FusiblePlug, 2.1.0.

What's changed?

1. I've added some basic exception handling that will dump them in the logs. That way if problems DO arise, they're easier to troubleshoot (proactive, things humans make never have problems).

2. I've added an option to roll up and archive the log. This is purely because the native notepad program sucks and chokes on larger files. When the log gets to 250kb, it rolls it into ./Archive inside of the defined log folder. The next time the log file reaches this, it writes over the old archived log file. 250kb represents roughly three months of logs.

3. Cleaned up some log and output wordage to be more clear.

Edit: Uploaded incorrect file. Fixed.


Attached Files
.zip   Fusible Plug 2.1.0.zip (Size: 13.62 KB / Downloads: 17)
Reply
#12
Also, to be clear. I AM working on a version of this to support multiple instances of srcds as long as they're sharing the same filebase (so only TF2 servers for instance).

I've gotten most of the details ironed out so now I'm just working through writing & testing everything.
Reply
#13
I'm halting development on this for awhile. I've got one more version to post and then I'm done. I'm shifting my focus away from this and into PKI so all my servers are being re-purposed. I'll check back occasionally. It's been fun.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)