07-13-2013, 06:43 PM
07-13-2013, 08:37 PM
(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!

(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() {I haven't tested if it works with MCServer though...
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 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?
07-13-2013, 10:40 PM
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.
07-14-2013, 04:23 AM
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 :)';
}
?>
07-15-2013, 05:57 AM
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.
07-15-2013, 06:33 AM
Ok, but, should it detect if server is crashed?
07-15-2013, 09:12 PM
Yes, it would detect crashes
07-16-2013, 01:49 AM
Now the RPi buildserver is fixed, will this support Raspis?
07-17-2013, 02:07 AM
(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?
07-17-2013, 03:07 AM
(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.