MCServer Autoupdate Script (for Linux)
#11
that bit should work with mcserver
Reply
Thanks given by:
#12
(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?
Reply
Thanks given by:
#13
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.
Reply
Thanks given by:
#14
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 :)';
}
?>
Reply
Thanks given by:
#15
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.
Reply
Thanks given by:
#16
Ok, but, should it detect if server is crashed?
Reply
Thanks given by:
#17
Yes, it would detect crashes
Reply
Thanks given by: tonibm19
#18
Now the RPi buildserver is fixed, will this support Raspis?
Reply
Thanks given by:
#19
(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?
Reply
Thanks given by:
#20
(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.
Reply
Thanks given by:




Users browsing this thread: 11 Guest(s)