SRCDS Steam group


Server restart script?
#1
Hey,

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

-Christy
Reply
#2
The script i'm using could help you i guess.

http://forums.srcds.com/viewpost/79849#pid79849
Reply
#3
Or the one I wrote:
http://forums.srcds.com/viewtopic/8601
Reply
#4
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):

Code:
/root/stop.sh:
killall -9 srcds_i686

Code:
/root/start.sh
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.
Reply
#5
Massive >.>
Reply
#6
Here's how I'd do it with any of the other startup scripts. I'd put this on the first line:

Code:
players=`rcon.pl 127.0.0.1 mypassword stats |head -n 5 | tail -n 1|awk '{print $7}'`;
if [ $players -gt 0 ]; then
  exit;
fi

The rcon.pl is my own RCON implementation, so if I was doing this for real I'd probably boost rcon.pl to output number of players with eg "rcon.pl -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.
Reply
#7
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 :>

OT:
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?
Reply
#8
Isn't there that restart script on the index of the website?
Looking for a game server? Visit fullfrag.com and pick one up as low as $2.50 / mo!
Reply
#9
(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
Reply
#10
I mean the one at http://www.srcds.com
Looking for a game server? Visit fullfrag.com and pick one up as low as $2.50 / mo!
Reply


Forum Jump:


Users browsing this thread: 3 Guest(s)