Forum

> > CS2D > Servers > Best method to check server status
Forums overviewCS2D overview Servers overviewLog in to reply

English Best method to check server status

7 replies
To the start Previous 1 Next To the start

moved Best method to check server status

AtomKuh
User Off Offline

Quote
I am in search of the best method to check the online status for quite some time now but I haven't found the best solution yet. I own a vServer (Ubuntu 14.04) on which runs CS2D and need a way to restart automatically the server after it went down.
Perhaps this question is more adressed to @user DC who is the creator of CS2D and can tell me about the best way to do it.

I already tried to ascertain whether it is running or not with a bash script that searchs for modifications of particular files that are changing when the server runs. This way of checking does not always work because the server keeps changing them after a DDOS attack.

What do you think about pinging the server?

Thanks in advance!

Admin/mod comment

Your question is mainly related with Servers and not Scripts in general. Moved. /user GeoB99

old Re: Best method to check server status

GeoB99
Moderator Off Offline

Quote
The most common method to check if whether the server is still running or not is by using a small Bash script with Crontab. user VADemon provided somewhere a working Bash script - click me! It just checks if the
cs2d_dedicated
process is dead or not.

Of course crontab must be installed in your machine first. To do so, paste the following command via Terminal:

sudo apt-get install cron


It'll prompt you to write your password in order to continue. For a manual reference use the command below:

man crontab

old Re: Best method to check server status

DC
Admin Off Offline

Quote
If you want to check if the server program is still running, a simple check with shell scripts - like already shared here - should be sufficient. I'm actually doing exactly what user GeoB99 described to automatically restart the U.S.G.N. master server in case there are problems.

An alternative way would be to ping the server periodically or to request its server info. This is more complicated though. If you configured your firewall correctly to handle the empty UDP packet attack, checking the process itself should be sufficient.

old Re: Best method to check server status

AtomKuh
User Off Offline

Quote
I just tried this cron method with the script you guys provided me (and it works) but I closed the server myself. I dont know what happens if someone attacks the server with DDOS that makes the server not able to communicate with other clients. Will the script consider this as a server down as well?

old Re: Best method to check server status

DC
Admin Off Offline

Quote
No, it only checks if the server process is still running. If the server is overloaded/unable to communicate but still running it won't be able to detect it. For that you would probably really need the more complicated approach I described (pinging / requesting info via a UDP socket).

old Re: Best method to check server status

AtomKuh
User Off Offline

Quote
@user DC: Could you provide me a command/script just to request the info, please?

Does it simply mean if I am not able to request the info the server is whether not able to communicate with other clients (attacked through DDOS) or not even running?

old Re: Best method to check server status

DC
Admin Off Offline

Quote
Unfortunately I do not have sample code for this at hand. You can find some PHP scripts somewhere here (forum or file archive) requesting and reading the basic server info.

Basically the idea is to send a request (maybe a few times because UDP is unreliable) and then wait for any responses. If you don't get a response within a few seconds you can assume that the server is not running properly.
To the start Previous 1 Next To the start
Log in to reply Servers overviewCS2D overviewForums overview