Update README.md
This commit is contained in:
parent
851c2a9718
commit
2467e1e2c9
1 changed files with 43 additions and 19 deletions
62
README.md
62
README.md
|
@ -1,7 +1,10 @@
|
|||
# Minecraft Backup
|
||||
Backup script for Linux servers running a Minecraft server in a GNU Screen
|
||||
|
||||
### Still in development, so use at your own risk!
|
||||
### Disclaimer
|
||||
Backups are essential to the integrity of your Minecraft world. You should automate regular backups and **check that your backups work**. While this script has been used in production for several years, it is up to you to make sure that your backups work and that you have a reliable backup policy.
|
||||
|
||||
Please refer to the LICENSE (MIT License) for the full legal disclaimer.
|
||||
|
||||
## Features
|
||||
- Create backups of your world folder
|
||||
|
@ -19,27 +22,48 @@ Backup script for Linux servers running a Minecraft server in a GNU Screen
|
|||
## Installation
|
||||
1. Download the script: `$ wget https://raw.githubusercontent.com/nicolaschan/minecraft-backup/master/backup.sh`
|
||||
2. Mark as executable: `$ chmod +x backup.sh`
|
||||
3. Configure the variables (in the top of the script)
|
||||
3. Use the command line options or configure default values at the top of `backup.sh`:
|
||||
|
||||
```bash
|
||||
SCREEN_NAME="PrivateSurvival" # Name of the GNU Screen your Minecraft server is running in
|
||||
SERVER_DIRECTORY="/home/server/MinecraftServers/PrivateSurvival" # Server directory, NOT the world; world is SERVER_DIRECTORY/world
|
||||
BACKUP_DIRECTORY="/media/server/ExternalStorage/Backups/PrivateSurvivalBackups" # Directory to save backups in
|
||||
NUMBER_OF_BACKUPS_TO_KEEP=128 # -1 indicates unlimited
|
||||
DELETE_METHOD="thin" # Choices: thin, sequential, none; sequential: delete oldest; thin: keep last 24 hourly, last 30 daily, and monthly (use with 1 hr cron interval)
|
||||
COMPRESSION_ALGORITHM="zstd" # Leave empty for no compression
|
||||
COMPRESSION_FILE_EXTENSION=".zst" # Leave empty for no compression; Precede with a . (for example: ".gz")
|
||||
COMPRESSION_LEVEL=3 # Passed to the compression algorithm
|
||||
ENABLE_CHAT_MESSAGES=true # Tell players in Minecraft chat about backup status
|
||||
PREFIX="Backup" # Shows in the chat message
|
||||
DEBUG=true # Enable debug messages
|
||||
```
|
||||
4. Create a cron job to automatically backup
|
||||
Command line options:
|
||||
```text
|
||||
-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
|
||||
-i Input directory (path to world folder)
|
||||
-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
|
||||
-s Minecraft server screen name
|
||||
-v Verbose mode
|
||||
```
|
||||
|
||||
a. Edit the crontab: `$ crontab -e`
|
||||
|
||||
b. Example for hourly backups: `00 * * * * /path/to/backup.sh`
|
||||
Example usage of command line options:
|
||||
```bash
|
||||
./backup.sh -c -i /home/server/minecraft-server/world -o /mnt/external-storage/minecraft-backups -s minecraft
|
||||
```
|
||||
This will use show chat messages (`-c`) in the screen called "minecraft" and save a backup of `/home/server/minecraft-server/world` into `/mnt/external-storage/minecraft-backups` using the default thinning delete policy for old backups.
|
||||
|
||||
4. Create a cron job to automatically backup:
|
||||
- Edit the crontab: `$ crontab -e`
|
||||
- Example for hourly backups: `00 * * * * /path/to/backup.sh`
|
||||
|
||||
## 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:
|
||||
```bash
|
||||
mkdir restored-world
|
||||
cd restored-world
|
||||
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.
|
||||
|
||||
## 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
|
||||
|
|
Loading…
Add table
Reference in a new issue