Cuberite Forum
MCServer Autoupdate Script (for Linux) - Printable Version

+- Cuberite Forum (https://forum.cuberite.org)
+-- Forum: Cuberite (https://forum.cuberite.org/forum-4.html)
+--- Forum: Discussion (https://forum.cuberite.org/forum-5.html)
+--- Thread: MCServer Autoupdate Script (for Linux) (/thread-1183.html)

Pages: 1 2 3


RE: MCServer Autoupdate Script (for Linux) - bearbin - 07-13-2013

that bit should work with mcserver


RE: MCServer Autoupdate Script (for Linux) - tigerw - 07-13-2013

(07-13-2013, 05:27 AM)xoft Wrote: You don't need to extract the config files, just instruct your unzipping program to extract only the binary.

It works!Big Grin

(07-13-2013, 07:12 AM)jimmis98 Wrote:
(07-13-2013, 02:11 AM)tigerw Wrote:
(07-13-2013, 01:54 AM)jimmis98 Wrote: I think that this could be of some help.

Nah, that's the vanilla server. It generates its config files, but the configuration for MCServer comes with the package. That is why it's frustrating, because with every new update, the old configs are overwritten.

But if you check the script, there is a part that closes the server. Here it is:
Quote:mc_stop() {
if pgrep -u $USERNAME -f $SERVICE > /dev/null
then
echo "Stopping $SERVICE"
as_user "screen -p 0 -S minecraft -X eval 'stuff \"say SERVER SHUTTING DOWN IN 10 SECONDS. Saving map...\"\015'"
as_user "screen -p 0 -S minecraft -X eval 'stuff \"save-all\"\015'"
sleep 10
as_user "screen -p 0 -S minecraft -X eval 'stuff \"stop\"\015'"
sleep 7
else
echo "$SERVICE was not running."
fi
if pgrep -u $USERNAME -f $SERVICE > /dev/null
then
echo "Error! $SERVICE could not be stopped."
else
echo "$SERVICE is stopped."
fi
}
I haven't tested if it works with MCServer though...

I managed to condense it quite a bit, so the script gracefully stops it now. Yay!

To xoft:

MCServer does capture and tie up SIGTERM right? So it stops gracefully?


RE: MCServer Autoupdate Script (for Linux) - tonibm19 - 07-13-2013

Does this script restart server automatically? It would be very nice an automatic external restart script, to avoid deadlocks. If someone makes it work with mcserver please post it.


RE: MCServer Autoupdate Script (for Linux) - tonibm19 - 07-14-2013

Should this restart script work? Is a php script that I found browsing the web. If set as an scheduled task maybe it detects if MCServer is crashed or deadlocked and restarts it.
PHP Code:
<?php
//options
$url 'localhost';
$port 25565;
$pauseLength 20;
//end options
$fp = @pfsockopen($url$port);
if (!
$fp) {
  echo 
'SERVER DOWN! Rebooting it.',"\r\n";
  `
Taskkill /IM MCServer.exe`;
  
sleep($pauseLength);
  `
C:\Users\user\Desktop\MCServer/MCServer.exe`;
} else {
  echo 
'SERVER UP :)';
}
?>



RE: MCServer Autoupdate Script (for Linux) - xoft - 07-15-2013

That is a windows-specific script that assumes that you have the MCServer on your desktop, and that your login is "user". Also, this script detects if the server is running by just pinging the server port; this will probably not detect a deadlock in the server, because the connection will still succeed.


RE: MCServer Autoupdate Script (for Linux) - tonibm19 - 07-15-2013

Ok, but, should it detect if server is crashed?


RE: MCServer Autoupdate Script (for Linux) - xoft - 07-15-2013

Yes, it would detect crashes


RE: MCServer Autoupdate Script (for Linux) - bearbin - 07-16-2013

Now the RPi buildserver is fixed, will this support Raspis?


RE: MCServer Autoupdate Script (for Linux) - tigerw - 07-17-2013

(07-16-2013, 01:49 AM)bearbin Wrote: Now the RPi buildserver is fixed, will this support Raspis?

If thou meanest this script, it should, once the wget address is changed.

PHP can stop MCServer? Wow! You learn something new every day.

I guess for the unresponsive restart, send SIGTERM, then maybe thirty seconds later, SIGKILL?

Xoft: MCServer does respond well to SIGTERM, correct?


RE: MCServer Autoupdate Script (for Linux) - bearbin - 07-17-2013

(07-17-2013, 02:07 AM)tigerw Wrote: Xoft: MCServer does respond well to SIGTERM, correct?

Why not test!

Also, if it does not respond well, put in a bug report.