diff options
-rw-r--r-- | README.md | 24 | ||||
-rw-r--r-- | README_zh_CN.md | 22 |
2 files changed, 46 insertions, 0 deletions
@@ -114,6 +114,30 @@ do done ``` +## 2.3 Automatic Regular Backup + +Currently KBackup does not support automatic backup by itself. However, If application level scheduled tasks are available to you, such as *crontab* in Linux and *Task Scheduler* in Windows, you can use that to trigger backup tasks regularly. + +### 2.3.1 On Linux + +In order to run Minecraft command on your server as a Shell command, you need RCON client like [mcrcon](https://github.com/Tiiffi/mcrcon). You can get the binary executable from its homepage and put it into anywhere like `/usr/bin`. + +Let's assume you are under Linux, run `crontab -e` and append this line to the configuration: + +```shell +0 */6 * * * mcrcon -P <RCON port> -p <RCON password> "kb backup" +``` + +You can specify RCON port and password in `server.properties`. + +This will cause `cron` to run `kb backup` for every 6 hours. To make incremental backups, simply replace `kb backup` to `kb incbak`. + +The man page [crontab(5)](https://man7.org/linux/man-pages/man5/crontab.5.html) also contains many useful information about using cron. + +### 2.3.2 On Windows + +For Windows users, please refer to [tutorials available on Google](https://www.google.com/search?q=create+scheduled+task+in+windows) for creating scheduled tasks. Note that mcrcon is also available on Windows. + # 3. To-Do List - A more friendly help menu (colored command help menu) diff --git a/README_zh_CN.md b/README_zh_CN.md index bbedd1a..b7d0570 100644 --- a/README_zh_CN.md +++ b/README_zh_CN.md @@ -92,3 +92,25 @@ do STATUS=$? done ``` + +## 2.3 定时自动备份 + +KBackup目前没有内置的定时备份功能,不过如果你可以使用操作系统或者其他计划任务程序提供的定时任务的话,可以用像[mcrcon](https://github.com/Tiiffi/mcrcon)之类的CRON客户端来定时运行Minecraft命令。 + +### 2.3.1 Linux + +如果你是Linux用户,首先将mcrcon可执行文件下载到合适的地方(比如`/usr/bin`),然后运行`crontab -e`,在配置文件末尾添加一条计划任务: + +```shell +0 */6 * * * mcrcon -P <RCON port> -p <RCON password> "kb backup" +``` + +这条任务会每隔6小时运行一次`/kb backup`命令,如果你需要增量备份,只需要把`kb backup`改为`kb incbak`。 + +RCON的端口和密码可以在`server.properties`文件设置。 + +可以参考man手册的条目[crontab(5)](https://man7.org/linux/man-pages/man5/crontab.5.html)来获得更多crontab的用法。 + +### 2.3.2 Windows + +如果你是Windows用户,可以用系统自带的“计划任务”功能。mcrcon也有Windows版,你可以参考任何一篇Windows计划任务的教程,仿照Linux上的配置方法来定时执行备份命令。
\ No newline at end of file |