minecraft-backup

授权协议 MIT License
开发语言 SHELL
所属分类 应用工具、 终端/远程登录
软件类型 开源软件
地区 不详
投 递 者 奚光霁
操作系统 跨平台
开源组织
适用人群 未知
 软件概览

Minecraft Backup

CI

Backup script for Minecraft servers on Linux.Supports servers running in screen, tmux, or with RCON enabled. Supports tar file or restic backup backends.

Features

  • Create backups of your world folder
  • Manage deletion of old backups
    • "thin" - keep last 24 hourly, last 30 daily, and use remaining space for weekly backups
    • "sequential" - delete oldest backup
  • Works on vanilla (no plugins required)
  • Print backup status to the Minecraft chat

Install

wget https://github.com/nicolaschan/minecraft-backup/releases/latest/download/backup.sh
chmod +x backup.sh

Make sure your system has tar and your chosen compression algorithm (gzip by default) installed.If using RCON, you will also need to have the xxd command.

Usage

# If connecting with RCON:
./backup.sh -c -i /home/user/server/world -o /mnt/storage/backups -s localhost:25575:secret -w rcon

# If running on screen called "minecraft":
./backup.sh -c -i /home/user/server/world -o /mnt/storage/backups -s minecraft

# If running on tmux session 0:
./backup.sh -c -i /home/user/server/world -o /mnt/storage/backups -s 0 -w tmux 

# Using restic (and RCON)
export RESTIC_PASSWORD="restic-pass-secret" # your password here
./backup.sh -c -i /home/user/server/world -r /mnt/storage/backups-restic -s localhost:25575:secret -w rcon

# Using Docker and RCON
# You will have to set up networking so that this Docker image can access the RCON server
# In this example, the RCON server hostname is `server-host`
docker run \ 
  -v /home/user/server/world:/mnt/server \
  -v /mnt/storage/backups:/mnt/backups \
  ghcr.io/nicolaschan/minecraft-backup -c -i /mnt/server -o /mnt/backups -s server-host:25575:secret -w rcon

This will show chat messages (-c) and save a backup of /home/user/server/world into /mnt/storage/backups using the default thinning deletion policy for old backups.

Command line options:

-a    Compression algorithm (default: gzip)
-c    Enable chat messages
-d    Delete method: thin (default), sequential, none
-e    Compression file extension, exclude leading "." (default: gz)
-f    Output file name (default is the timestamp)
-h    Shows this help text
-H    Set hostname for restic backup (restic only)
-i    Input directory (path to world folder, use -i once for each world)
-l    Compression level (default: 3)
-m    Maximum backups to keep, use -1 for unlimited (default: 128)
-o    Output directory
-p    Prefix that shows in Minecraft chat (default: Backup)
-q    Suppress warnings
-r    Restic repo name (if using restic)
-s    Screen name, tmux session name, or hostname:port:password for RCON
-t    Enable lock file (lock file not used by default)
-u    Lock file timeout seconds (empty = unlimited)
-v    Verbose mode
-w    Window manager: screen (default), tmux, RCON

Automate backups with cron

  • Edit the crontab with crontab -e
  • Example for hourly backups:
00 * * * * /path/to/backup.sh -c -i /home/user/server/world -o /mnt/storage/backups -s minecraft

Retrieving Backups

Always test your backups! Backups are in the tar format and compressed depending on the option you choose. To restore, first decompress if necessary and then extract using tar. You may be able to do this in one command if tar supports your compression option, as is the case with gzip:

Example:

mkdir restored-world
cd restored-world
tar -xzvf /path/to/backups/2019-04-09_02-15-01.tar.gz

The restored worlds should be inside the restored-world directory, possibly nested under the parent directories. Then you can move your restored world to your Minecraft server folder under the proper name and path so the Minecraft server uses it.

With restic

Use restic restore to restore from backup.

Why not use tar directly?

If you use tar while the server is running, you will likely get an error like this because Minecraft autosaves the world periodically:

tar: /some/path/here/world/region/r.1.11.mca: file changed as we read it

To fix this problem, the backup script disables autosaving with the save-off Minecraft command before running tar and then re-enables autosaving after tar is done.

Help

  • Make sure the compression algorithm you specify is installed on your system. (zstd is not installed by default)
  • Make sure your compression algorithm is in the crontab's PATH
  • Make sure cron has permissions for all the files involved and access to the Minecraft server's GNU Screen
  • It's surprising how much space backups can take--make sure you have enough empty space
  • Do not put trailing / in the SERVER_DIRECTORY or BACKUP_DIRECTORY
  • If "thin" delete method is behaving weirdly, try emptying your backup directory or switch to "sequential"

Known Issues

There is a Minecraft bug MC-217729 in recent Minecraft server versions that cause them to automatically save the world even after receiving the save-off command. Until this is fixed, there is a chance that the backup will fail because the world files are modified by Minecraft in the process of creating the backup. This script will try to detect and report this problem if it does occur.

Disclaimer

Backups are essential to the integrity of your Minecraft world. You should automate regular backups and check that your backups work. It is up to you to make sure that your backups work and that you have a reliable backup policy.

Some backup tips:

  • Drives get corrupted or fail! Backup to a different drive than the one your server is running on, so if your main drive fails then you have backups.
  • Automate backups so you never lose too much progress.
  • Check that your backups work from time to time.

Please refer to the LICENSE (MIT License) for the full legal disclaimer.

  • We're now releasing the first pre-release of 1.14.2 which addresses a few bugs. Please report any bugs you find on our bug tracker, it helps a lot! Update:We've now released 1.14.2 pre-release 4 and w

  • 似乎少有关于 minecraft 自动备份的脚本,在此记录一下比较野鸡的方法。如果有更好的方法请告诉我! 一、开服 MC开服一直都比较简单,以fabric为例只需要打开链接,选择好对应版本,然后下载即可。开服的指令网页里也准备好了,即 java -Xmx2G -jar XXX.jar nogui 那句指令。先运行一遍,会自动生成 eula.txt 文件,打开将里面的 false 改为 true 再

  • hi~大家好,这里是px君uag今天早上px君打开MC启动器的时候看到MOJANG更新了minecraft pre6 (貌似几天前就更新了) 让我们看看更新了什么 更新内容 Changed dolphin treasure finding behaviour to be more on partiy with Bedrock 使海豚寻宝更像基岩版 Improved fonts 改进字体(译注:部分

  • 《我的世界》是有史以来最受欢迎的游戏之一。本教程说明了如何在Ubuntu 20.04上制作Minecraft服务器。我们将使用Systemd运行Minecraft服务器,并使用该mcrcon实用程序连接到正在运行的实例。我们还将向您展示如何创建执行常规服务器备份的cronjob。 《我的世界》是有史以来最受欢迎的游戏之一。这是一款沙盒视频游戏,玩家可以探索无限的世界,并建造从简单的房屋到高耸的摩天

  • 服务器使用cron服务定时备份 自动配置cron定时任务,确保自己使用的是cteos7.*版本系统再使用 #!/bin/sh echo "此脚本只兼容cteos7.*版本" echo "启动cron服务" systemctl start crond.service echo "将自动备份任务写入cron服务" echo "57 23 * * * /root/backups/lobby_backup

 相关资料
  • Minecraft 是一款用 Python 开发的,克隆 Minecraft 的游戏。 使用方法: pip install pygletgit clone https://github.com/fogleman/Minecraft.gitcd Minecraftpython main.py

  • Minecraft Overviewer 是高解析度的minecraft世界渲染器与谷歌地图接口

  • Minecraft-Overviewer 是一个命令行工具,用来显示高分辨率的 Minecraft 世界地图,它可生成一组静态的 HTML和图像文件,并且可用谷歌地图的 API 来显示一个友好的互动地图。 提示: Minecraft-Overviewer 的所有文档,如要下载信息,查看编译,安装,运行等文档,均可以在文档网站查找。  

  • 我有一台运行10.5.8MacOSX和2.5.1Python的PowerPCMac。当我尝试运行我下载的MCP文件夹中的任何文件时,会出现以下错误:Macintosh-2:MCP Rosty$bash bash-3.2$/Users/Rosty/Documents/MCP/updatemcp。sh/Users/Rosty/Documents/MCP/runtime/commands。py:137:

  • 我正在为1.8.9编写一个minecraft mod,除了这一行,其他一切都可以正常工作。文件基本上看起来像 坠机记录告诉我 这是我使用Minecraft的唯一一条线。getMinecraft()。我做错了什么?

  • Remix this example on Glitch. Or view the demo. Let’s build a basic Minecraft (voxel builder) demo that targets room scale VR with controllers (e.g., Vive, Rift). The example will be minimally usable