diff options
author | keuin <[email protected]> | 2020-07-25 14:10:58 +0800 |
---|---|---|
committer | keuin <[email protected]> | 2020-07-25 14:10:58 +0800 |
commit | d50beeb1f082295f3ae9d4707c932ad2808f0568 (patch) | |
tree | 770732ab09cdadb46b57430d057b158fc677c25a | |
parent | 021959233f38d1bbcfe6fbcac4c64ab524a70eac (diff) | |
parent | e62d1b52324cbcdef4c6c215417965236fe1cfec (diff) |
Merge branch 'master' of https://github.com/keuin/KBackup-Fabric
-rw-r--r-- | README.md | 36 |
1 files changed, 34 insertions, 2 deletions
@@ -6,7 +6,7 @@ Minecraft version: 1.14.4 [Fabric API](https://minecraft.curseforge.com/projects/fabric/files) is required! -commands: +## 1. Commands - **/kb** or **/kb help**: show command list - **/kb list**: show existing backups @@ -16,8 +16,40 @@ commands: - **/kb delete**: delete an existing backup. - **/kb prev**: Find and select the most recent backup file. +## 2. Script for auto-restart after restoring -To-Do List: +Due to the nature of JVM: the Java language's running environment, there is no elegant way to restart Minecraft server in a server plugin. In order to achieve auto restarting, the outer system-based script is required, i.e the script is a batch or a shell script. + +KBackup exit JVM with a special code `111` after restoring the level successfully. The startup script just check the exit code and restart Minecraft server if the code is `111`. + +I will give examples for some popular operating systems. To use these scripts, you should replace your start.bat or start.sh script with given code lines. + +### 2.1 Script for Windows + +```batch +@echo off +title Keuin's personal Minecraft server +:loop +java -Xms4G -Xmx4G -jar fabric-server-launch.jar nogui +if %errorlevel%==111 goto loop +rem kbackup restore auto restart +pause +``` + +### 2.2 Script for Linux or U\*ix using shell + +```shell +#!/bin/sh +STATUS=111 +while [ $STATUS -eq 111 ] +do + java -Xms4G -Xmx4G -jar fabric-server-launch.jar nogui + STATUS=$? +done +``` + + +## 3. To-Do List: - New version checker. - Refactor code. |