From 5210769da03df76174939a9bdfa68a99257fb5a2 Mon Sep 17 00:00:00 2001 From: TheMightyV Date: Sat, 15 Jan 2022 23:38:35 +0100 Subject: Updated Readme --- Readme.md | 65 +++++++++++++++++++++++++++++++++++++++++++++++++++++---------- 1 file changed, 55 insertions(+), 10 deletions(-) diff --git a/Readme.md b/Readme.md index 757e394..304521d 100644 --- a/Readme.md +++ b/Readme.md @@ -1,18 +1,31 @@ # minecraft-server-tools -My minecraft server management script with safe online Backup. +My minecraft server management script with safe online backup. + +Supports backing up using several backends to multiple local and remote directories. + +## Dependencies + +- [tmux](https://github.com/tmux/tmux) + +Either of backup backends: +- tar +- [bup](https://github.com/bup/bup) +- [borgbackup](https://github.com/borgbackup/borg) + +All of them are available on the Debian repository. ## Configuration -Config-variables are located at the top of `server.sh` +Config variables are located at `serverconf.sh`. ## Usage -`./server.sh start|stop|attach|status|backup` +`./server.sh start|stop|attach|status|backup|fbackup|restore|ls` ### start -Creates a `screen` session and starts a minecraft server within. +Creates a `tmux` session and starts a minecraft server within. Fails, if a session is already running with the same sessionname. ### stop @@ -21,26 +34,54 @@ Sends `stop` command to running server instance to safely shut down. ### attach -attaches to `screen` session. Exit with `CTRL + A d` +Attaches to tmux session with a server. Detach with `CTRL + A d`. ### status -lists active screen sessions with `SCREEN_SESSIONNAME`. +Shows if the server is running. ### backup -Backs up the world as a `tar.gz` archive in `./backup/`. -If a running server is detected, +Creates a backup of the current world: + +- If a running server is detected, the world is flushed to disk and autosave is disabled temporarily to prevent chunk corruption. -The command specified in `$BACKUP_HOOK` is +- Initializes backup directories if needed. + +- Backs up the world **if there are players on the server**. +The backup has `$BACKUP_NAME_` prefix. + +- Performs tests: backup is pulled from each backup directory and is compared to the current world. +This behaviour is controlled with `$BACKUP_CHECK_MODE`. + +- The command specified in `$BACKUP_HOOK` is executed on every successful backup. `$ARCHNAME` contains the relative path to the archive. This can be used to further process the created backup. +This is recommended for automated backups. + +**Warning** If all players leave just before a backup, progress is not saved. + +### fbackup + +Does the same as `backup`, but does not check for presence of players. + +This is not recommended for automated use except for deduplicating backup backends (bup and borgbackup). + +### restore + +Restores a backup from selected directory. +Old world is preserved with a current timestamp. + +### ls + +Lists backups in all directories. + ## Start automatically Create user and group `minecraft` with home in `/var/minecraft`. -Populate the directory with server.sh and a server jar. +Populate the directory with `server.sh`, `serverconf.sh`, `backends` and a server jar. Place `minecraft.service` in `/etc/systemd/system/` and run `systemctl start minecraft` to start once or `systemctl enable minecraft` to enable autostarting. @@ -62,3 +103,7 @@ The scripts are provided as-is at no warranty. They are in no way idiot-proof. Improvements are welcome. + +## TODO +- Allow non-forced backup to be run one time with no players on the server. +- Reach similar automated behaviour without depending on systemd? -- cgit v1.2.3