6

There is no built-in implementation in a Vanilla Minecraft server to force a save every X minutes, then back up the files into a folder. I know how to do log rotations and I can also do a normal backup using Window's XCOPY or ROBOCOPY, but have no idea how to do it when the server is running to prevent possible data corruption.

How can I perform an automatic backup that ensures a consistent state of the game data?

The server is running on Windows.

  • 1
    I've voted to close this question because it seems to be asking for a software recommendation, which is off-topic. – LoveAndCoding Mar 4 '13 at 5:53
  • @ktash Is there a way for me to reword it in a way so that it is on topic? – user28379 Mar 4 '13 at 20:44
  • This question is being discussed at Arqade Meta: meta.gaming.stackexchange.com/questions/6962/… – galacticninja Mar 6 '13 at 14:04
  • I'm just confused as to why it was not closed when I first asked it. – user28379 Mar 7 '13 at 1:11
  • 1
    @jeffreylin_ yeah I feel your pain .. some moderators just quickly vote to close without even asking for more information regarding your question ... Oh and also a bombardment of downvotes .. haha .. – Render Mar 9 '13 at 20:57
1

See here for a list of Server managers, which should help you with more than just backups. http://www.minecraftwiki.net/wiki/Programs_and_editors/Server_wrappers

7

On Linux, I came up with a rather basic solution which you can find here: https://github.com/pwaller/waitsilence

The idea is to use inotifywait | waitsilence to determine when minecraft has finished writing its backup out. That allows you to avoid corruption.

If you run your minecraft session inside a named screen (e.g, screen -S minecraft), then you can send text into minecraft's input with screen -r -S minecraft -X stuff $'\nsave-all\nsave-off\n'. The -r flag prevents the screen writing save-all, save-off into the screen if it is currently attached.

inotifywait then writes what file modifications are seen, and I wrote waitsilence (above) to wait until nothing has been written for a few seconds.

This can all be put into a backup.sh script which is then run via cron.

  • Do you have a version of this for Windows? – user28379 Mar 2 '13 at 21:47
  • I'm afraid not :( – pwaller Mar 3 '13 at 22:42
  • Darn. I need this for Windows though. – user28379 Mar 3 '13 at 22:43
  • Hi! I appreciate I'm (very) late to this party, but just wanted to say thanks for this. It's really helpful. One question: I notice you include "stuff" before the minecraft commands. Is this just some form of padding (it's not a terminal command on my machine). I find it very odd that the commands don't seem to work without "stuff" even though it isn't technically valid. Thanks. – Josh Jul 10 '17 at 17:11
  • You're going to pinch yourself, as I just pinched myself reading your comment. stuff is the command. As in "to stuff some things into the terminal". – pwaller Jul 11 '17 at 18:11

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy