(12-19-2015, 12:06 PM)Zee1234 Wrote:(12-19-2015, 11:12 AM)Rekuen Wrote:(12-19-2015, 06:04 AM)bearbin Wrote: How are you stopping the server? Are you piping in a message or sending a kill signal?
If you're sending a message then you can just send in "say message".
Right now I'm just killing the signal to stop the server, i search for the cuberite detached screen pid and send a kill signal. I supposed there is a better way to stop the server, is a wip so I'm open to suggestions.
Should be able to useCode:screen {your stuff} -x exec stop`printf(\\n)`
Unless your screen doesn't support that syntax/I'm outdated (shouldn't be since I checked this a few weeks ago and screen's a fairly stable program), or I'm remembering wrong.
Thanks, it wasn't exactly like that but I got it working, the only thing left is to know what files to preserve, or not to override from the tar in every update.
So far this is what I got:
Debian based service/daemon:
service cuberite start -> check for updates and starts the server
service cuberite stop -> stops the server instantly, without warning the users.
service cuberite restart -> stops the server instantly, updates the server, and launch it again.
service cuberite update -> Sends a warning message to the users online through chat, that the server is going down for maintenance in 5 minutes. Every minute sends another message. Once the 5 minutes has passed it stops the server, check for updates, and relaunchs the server.
Restart and update, is the same thing, but one is for development/testng servers so to speak, and the other for production servers with players in it.
The other part are the cronjobs, as said before, one checks every X minutes that the server is online, if not, checks for updates, and starts the server again.
The other cronjob is the one that executes the update command of the service at the time of your preference, every day, at 06:00 AM for example.
Combining the two, cron and service one could forget about being constantly monitoring the server.
TODO: make an install script, that checks dependencies like screen, installs them, copy the service to init.d and update update-rc.d and asks you some questions to set up the cronjobs.
If people is interested I can adapt it to fedora or other distributions, and I'm open to suggestions, once I have it polished i will publish it on github.
Thanks again and sorry for my English.