-
Notifications
You must be signed in to change notification settings - Fork 106
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
master server as service on Linux - Automatic Restart After Crash #200
Comments
Hi there. I'm still reading about MasterServer before using it, but I've seen your question, and here is an idea. How about registering a cron job to call this script below, like every three minutes?
#!/bin/bash
ps auxw | grep GameServer.x86_64 | grep -v grep > /dev/null
if [ $? != 0 ]; then
cd $(dirname $(which $0) )
./GameServer.x86_64
fi If you have Probably there's a better way to achieve this, but this is what came to mind for now. Used to work for me two years ago, on another project. Check this topic to get more ideas for bash scripts. |
@felladrin thanks a lot! I also thought about this but was worried about the availability of the service during the 3 minutes windows, that is, if the server somehow crashes, it is possible that it can only be restarted in 3 minutes or within another time window defined in cron jobs. Taking it further, will the masterserver have something there that can be a "gate server" that acts as a package dispatcher? Which means, I can start two servers in parallel: one is called "Online Server", another can be called as "Standby Server". The gate server distributes the received packages from clients to the two server always, but once the Online Server dies, it will make the Standby Server as the Online Server and creates another server as a Standby server. Of course, the complexity of the gate server should be minimised to make sure it can be always online and/or some other measures can be taken to make it alive all the time. Of course, I will try your method for now but any discussions around this "gate server" would be highly welcomed! Thanks a ton! |
Dear all, I am now trying to deploy the server to the cloud but realised that I am not sure how to make the server as a service and how to restart it autonomically if there is any bug that crashes the server.
Would there be any advice from you guys? Thanks!
The text was updated successfully, but these errors were encountered: