SRCDS Steam group


srcds monitoring software
#1
sometimes the server hangs and doesn't restart itself.I want some one to point me to a software that monitors the server by sending rcons to it and if the server replys to do nothing but if the server doesn't to Ctrl + c and then start the screen again.

Does anybody know such software ?
Reply
#2
I have written a shell script to do this:

Code:
#!/bin/sh

PORTS="27015 29015"
IP="yourip"
RCONPW="yourpassword"
NMAX=24

echo Watching ports: $PORTS

while /bin/true; do

  for PORT in $PORTS; do

    echo -n "$PORT "

    RET=`./rcon -P$RCONPW -p$PORT -a$IP echo hangcheck | head -n 1`
    if [ "x$RET" != "xhangcheck " ]; then
      chmod 666 .hangcount.$PORT
      N=`cat .hangcount.$PORT`
      N=$(( N + 1 ))
      echo
      echo "Attempt $N failed to port $PORT..."
      if [ $N -ge $NMAX ]; then
        PID=`ps ax | grep -e "-port $PORT" | grep -v grep | sed -e "s/ pts.*\$//"`
        echo "sending SIGKILL to $PID..."
        kill -9 $PID
        N=0
      fi
    else
      N=0
    fi
    echo $N > .hangcount.$PORT

  done

  sleep 5

done

It requires a program called 'rcon' for the rcon connections. You can download it here:
http://pool.beta-centauri.de/rcon
Put it into the same directory as the script. Run the script in some screen to monitor its operation...

EDIT: run the servers with -autoupdate, the script only kills the servers if they are hung!
http://www.fpsmeter.org
http://wiki.fragaholics.de/index.php/EN:Linux_Optimization_Guide (Linux Kernel HOWTO!)
Do not ask technical questions via PM!
Reply
#3
I thank you very much for your quick reply .... i found this here :
http://www.dumbclan.co.uk/forum/index.php?showtopic=5496

give me advice which one to use yours or the other ?

which one is better?

Tnx once again for helping me
Reply
#4
i got some errors ... can you help me pls

Attempt 1 failed to port 27016...
27017 chmod: cannot access `/mnt/data/log/.hangcount.27017': No such file or directory
cat: /mnt/data/log/.hangcount.27017: No such file or directory

Attempt 1 failed to port 27017...
27015 chmod: cannot access `/mnt/data/log/.hangcount.27015': No such file or directory
cat: /mnt/data/log/.hangcount.27015: No such file or directory

Attempt 1 failed to port 27015...
27016 chmod: cannot access `/mnt/data/log/.hangcount.27016': No such file or directory
cat: /mnt/data/log/.hangcount.27016: No such file or directory

Attempt 1 failed to port 27016...
27017 chmod: cannot access `/mnt/data/log/.hangcount.27017': No such file or directory
cat: /mnt/data/log/.hangcount.27017: No such file or directory

Attempt 1 failed to port 27017...
Reply
#5
oh sorry, I forget to change some path. I have edited the version above, update and try again. (beware that the script will created some hidden files in the working directory)
http://www.fpsmeter.org
http://wiki.fragaholics.de/index.php/EN:Linux_Optimization_Guide (Linux Kernel HOWTO!)
Do not ask technical questions via PM!
Reply
#6
now another came up :

Attempt 10 failed to port 27015...
27016
Attempt 10 failed to port 27016...
27017
Attempt 10 failed to port 27017...
27015
Attempt 11 failed to port 27015...
27016
Attempt 11 failed to port 27016...
27017
Attempt 11 failed to port 27017...
27015
Attempt 12 failed to port 27015...
27016
Attempt 12 failed to port 27016...
27017
Attempt 12 failed to port 27017...
27015

pls explane in detiles what do i have to do ,and what there is in the rcon file + what is gonna be the action taken when the server hangs .

i run the servers not root i run them by user ... and are the gonna start with the same user or what ? i'm worried about this
Reply
#7
if it hangs at startup, see http://forums.srcds.com/viewtopic/11504
Reply
#8
my server hangs on map change ... it's updated so i don't think this is the reason .,.. waiting BehaartesEtwas to say what to do ...
Reply
#9
Probably an invalid map. Or a plugin causing this.
Reply
#10
realchamp Wrote:Probably an invalid map. Or a plugin causing this.


all i need is to get this server tool working ,could you help me pls ?
Reply
#11
Which server tool? HLDSUpdateTool?
Reply
#12
the script from BehaartesEtwas in the 2-nd post
Reply
#13
sorry, I did another mistake :-) you need to fill in the rcon password as well...
http://www.fpsmeter.org
http://wiki.fragaholics.de/index.php/EN:Linux_Optimization_Guide (Linux Kernel HOWTO!)
Do not ask technical questions via PM!
Reply
#14
ok ... could you pls explane what is

LD_PRELOAD=
NMAX=24


and still does not work :

Code:
#!/bin/sh

PORTS="27015 27016 27017"
IP="myip"
RCONPW="password"
LD_PRELOAD=
NMAX=24

echo Watching ports: $PORTS

while /bin/true; do

  for PORT in $PORTS; do

    echo -n "$PORT "

    RET=`./rcon -Pstofftier -p$PORT -a$IP echo hangcheck | head -n 1`
    if [ "x$RET" != "xhangcheck " ]; then
      chmod 666 .hangcount.$PORT
      N=`cat .hangcount.$PORT`
      N=$(( N + 1 ))
      echo
      echo "Attempt $N failed to port $PORT..."
      if [ $N -ge $NMAX ]; then
        PID=`ps ax | grep -e "-port $PORT" | grep -v grep | sed -e "s/ pts.*\$//"`
        echo "sending SIGKILL to $PID..."
        kill -9 $PID
        N=0
      fi
    else
      N=0
    fi
    echo $N > .hangcount.$PORT

  done

  sleep 5

done


Code:
:~/AutoRestartSrcds$ ./autorestart.sh
Watching ports: 27015 27016 27017
27015
Attempt 21 failed to port 27015...
27016
Attempt 21 failed to port 27016...
27017
Attempt 21 failed to port 27017...
27015
Attempt 22 failed to port 27015...
27016
Attempt 22 failed to port 27016...
27017
Attempt 22 failed to port 27017...
Reply
#15
NMAX=24 defines a maximum number of consecutive failures before it kills the server.

you are still using a wrong version. I forget to remove my own rcon password (don't try, it's already changed Toungue), so copy the whole script from my post above again.

"LD_PRELOAD=" does nothing and can be removed :-)
http://www.fpsmeter.org
http://wiki.fragaholics.de/index.php/EN:Linux_Optimization_Guide (Linux Kernel HOWTO!)
Do not ask technical questions via PM!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)