SRCDS Steam group

Server restart script?

I'm looking for a SRCDS restart script, as you know Linus SRCDS's eat ram after idleing for too long, and tend to run a bit better after a restart. Also restarting a war server mid EUGL/ESL/League game would = hours of ear bleed from the community. So I've though about this:

Using a PHP script run on the hour from crontab, that queries my SRCDS's for the player count. If the player count is 1 or above (I don't know what sourceTV will count as) to run another script that kills the SRCDS by "kill /pathtosrcds/pid.pidfile"

It's the script to query the game server that I don't know how to do, I've though about using PHP as I know there is allot of socket stuff to do this, but I',m not sure how.

I'm also open to suggestions for alternative ways of doing this Big Grin

The script i'm using could help you i guess.
Or the one I wrote:
Two posts which either one does what he asked for. Is this helping?

My script (which also does not answer the first one, but at least I'm honestly saying it took about 0 second to write):

killall -9 srcds_i686

PARAMETERS=-game cstrike +map de_dust2
./srcds_run $PARAMETERS

@D4rKr0W, Arjen
You don't check whether there are players on the server.

PS. It'd take about 15 minutes for me to write script he asked for, but I'm not sure he's ever going to use it anyway. Sorry Sad The idea is very good, though.
Massive >.>
Here's how I'd do it with any of the other startup scripts. I'd put this on the first line:

players=` mypassword stats |head -n 5 | tail -n 1|awk '{print $7}'`;
if [ $players -gt 0 ]; then

The is my own RCON implementation, so if I was doing this for real I'd probably boost to output number of players with eg " -players" so there's no need for the ugly head|tail|awk parsing.

It shouldn't be too difficult to use any of the freely available rcon programs to script the same logic.

PS. It took 0 seconds to think through. About 1 minute to write, though.
PSS. Edited the previous post not to bash noobs so much Smile.
Well if i was in his position with little to no knowledge of bash scripting, i'd get my hands dirty with either one of the scripts to extrapolate the code i need, that was the reason for me posting the link :>

you're on hetzner, right? i could use some tips on administering servers, you seem to know what you're doing, mind if i add you on steam?
Isn't there that restart script on the index of the website?
Looking for a game server? Visit and pick one up as low as $2.50 / mo!
(11-20-2009, 09:41 PM)loopyman Wrote:  Isn't there that restart script on the index of the website?

Mine? Could be. Didn't write it myself and i'm not taking credit for it :p
I mean the one at
Looking for a game server? Visit and pick one up as low as $2.50 / mo!

Forum Jump:

Users browsing this thread: 1 Guest(s)