From 81f84d8aa4b366b8c2d39ca7ba2190c904fd8c31 Mon Sep 17 00:00:00 2001 From: Nicolas Chan Date: Mon, 3 May 2021 14:41:44 -0700 Subject: [PATCH] Update README --- README.md | 18 +++++++++++++++++- backup.sh | 2 +- 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 3f1a4bb..c46073a 100644 --- a/README.md +++ b/README.md @@ -3,7 +3,7 @@ [![codecov](https://codecov.io/gh/nicolaschan/minecraft-backup/branch/master/graph/badge.svg?token=LCbVC4TbYJ)](https://codecov.io/gh/nicolaschan/minecraft-backup) Backup script for Minecraft servers on Linux. -Supports servers running in [screen](https://en.wikipedia.org/wiki/GNU_Screen), [tmux](https://en.wikipedia.org/wiki/Tmux), or with [RCON](https://wiki.vg/RCON) enabled. +Supports servers running in [screen](https://en.wikipedia.org/wiki/GNU_Screen), [tmux](https://en.wikipedia.org/wiki/Tmux), or with [RCON](https://wiki.vg/RCON) enabled. Supports `tar` file or [`restic`](https://restic.net/) backup backends. ## Features - Create backups of your world folder @@ -32,6 +32,18 @@ If using RCON, you will also need to have the [`xxd`](https://linux.die.net/man/ # 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. @@ -50,6 +62,7 @@ Command line options: -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 -v Verbose mode -w Window manager: screen (default), tmux, RCON @@ -74,6 +87,9 @@ tar -xzvf /path/to/backups/2019-04-09_02-15-01.tar.gz Then you can move your restored world (`restored-world` in this case) to your Minecraft server folder and rename it (usually called `world`) so the Minecraft server uses it. +### With `restic` +Use [`restic restore`](https://restic.readthedocs.io/en/latest/050_restore.html) 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: ``` diff --git a/backup.sh b/backup.sh index 06bad21..ae5a15a 100755 --- a/backup.sh +++ b/backup.sh @@ -57,9 +57,9 @@ while getopts 'a:cd:e:f:hi:l:m:o:p:qr:s:vw:' FLAG; do echo "-l Compression level (default: 3)" echo "-m Maximum backups to keep, use -1 for unlimited (default: 128)" echo "-o Output directory" - echo "-r Restic repo name (if using restic)" echo "-p Prefix that shows in Minecraft chat (default: Backup)" echo "-q Suppress warnings" + echo "-r Restic repo name (if using restic)" echo "-s Screen name, tmux session name, or hostname:port:password for RCON" echo "-v Verbose mode" echo "-w Window manager: screen (default), tmux, RCON"