Automatic Restart on Crash (i.e.

Currently I’m running Garry’s Mod (for a TTT server) within GNU screen, so I can easily reattach to get access to the game console. (Running on a Debian box.) I have a shell script that boots the server with the required arguments, launching a new screen session.

However, I’d like to have some sort of process supervisor to automatically bring the game back up when it crashes. (e.g. systemd, daemontools, supervisord) But I’d still like to have an easy way to access the game console to watch it and issue commands when I SSH into the box. How’s the best way to go about this? Some sort of trickery to supervise the screen session? No screen session and some sort of RCON client? (Also, I’ve yet to find a simple, non-graphical Linux RCON client that acts in this manner…)

Any advice?

I’m not 100% sure if someone has made a server monitor for Linux but I would suggest googling it and you may find something.

But your server should restart automatically provided it’s running in debug mode, the only time this does not catch this is when the server throws a engine error dialogue message but that’s pretty rare to be honest.

It wouldn’t be to hard to detect if the processes has stopped responding but sometimes it continues to run even when crashed. But I run Windows servers so I’m sure Linux server host’s have better tips.

The built in restart script is good enough, really (should be turned on automatically, just try and crash your server). It hasn’t failed me once.

Yeah, works for me on Debian. Also works on the newest version of Ubuntu for me.

I’m using srcds_run, but when it crashes (every now and then) it causes the screen session to terminate. Is it supposed to come back up otherwise?

this should help

Run something like:



#!/bin/bash

NAME="gmod"

if [[ `screen -ls | grep $NAME` == ""]]
then

    # create game with screen name $NAME

fi


On a cronjob or something.

Thanks for the help. I went the cronjob route. (Simple solution. I like it.)