diff --git a/DEPLOY.md b/DEPLOY.md index 8fe6876..fc4a419 100644 --- a/DEPLOY.md +++ b/DEPLOY.md @@ -22,7 +22,9 @@ MineSentinel 是一个 Minecraft 服务器守护进程,每 1.5 秒检测服务 /opt/minecraft/sentinel/ # 推荐部署目录 ├── main.rb # 主程序入口 —— 检测循环 + 冷却期 + 初始宽限期 ├── method_executor.rb # 日志系统 + 重启逻辑 + 重试计数器 -└── server_status_detector.rb # TCP 端口检测模块 +├── server_status_detector.rb # TCP 端口检测模块 +├── systemd_notifier.rb # systemd watchdog 心跳发送 +└── config.rb # 可调参数配置 minesentinel.service # systemd 单元文件(项目源码中) ``` @@ -35,7 +37,7 @@ minesentinel.service # systemd 单元文件(项目源码中) ```bash mkdir -p /opt/minecraft/sentinel -cp main.rb method_executor.rb server_status_detector.rb /opt/minecraft/sentinel/ +cp main.rb method_executor.rb server_status_detector.rb systemd_notifier.rb config.rb /opt/minecraft/sentinel/ ``` ### 2. 确认 Minecraft systemd 服务存在 @@ -132,9 +134,10 @@ MineSentinel 启动: | 参数 | 文件 | 行 | 默认值 | |------|------|-----|--------| -| 初始宽限期 | `main.rb` | 31 | `300` s | -| 检测间隔 | `main.rb` | 69 | `1.5` s | -| 冷却期 | `main.rb` | 58 | `200` s | +| 初始宽限期 | `config.rb` | 1 | `300` s | +| 冷却期 | `config.rb` | 3 | `200` s | +| 尝试次数 | `config.rb` | 2 | `3` 次 | +| 检测间隔 | `main.rb` | 90 | `1.5` s | | systemctl 超时 | `method_executor.rb` | 17 | `30` s | | 最大重试 | `method_executor.rb` | 23 | `10` 次 | | 检测端口 | `server_status_detector.rb` | 60 | `25565` | diff --git a/OfficialWebsite/index.html b/OfficialWebsite/index.html index fde40f3..c44240e 100644 --- a/OfficialWebsite/index.html +++ b/OfficialWebsite/index.html @@ -535,6 +535,7 @@

方式二:手动复制

mkdir -p /opt/minecraft/sentinel
 cp main.rb method_executor.rb server_status_detector.rb \
+   systemd_notifier.rb config.rb \
    /opt/minecraft/sentinel/

3. 手动测试

@@ -587,9 +588,10 @@ journalctl -u minesentinel -u minecraft -f # 双服务合并

⚙️ 可调参数

- - - + + + + diff --git a/README.md b/README.md index 6ea15bb..4a3fdf7 100644 --- a/README.md +++ b/README.md @@ -16,7 +16,7 @@ Minecraft 服务器守护进程 ```bash # 复制文件 mkdir -p /opt/minecraft/sentinel -cp main.rb method_executor.rb server_status_detector.rb /opt/minecraft/sentinel/ +cp main.rb method_executor.rb server_status_detector.rb systemd_notifier.rb config.rb /opt/minecraft/sentinel/ # 安装 systemd 服务 cp minesentinel.service /etc/systemd/system/ @@ -61,6 +61,8 @@ MineSentinel 通过 `Before=minecraft.service` 确保先于 MC 启动,避免 M | `main.rb` | 主循环、冷却期控制、初始宽限期 | | `method_executor.rb` | 日志系统、systemctl 重启、计数器 | | `server_status_detector.rb` | TCP 端口检测模块 | +| `systemd_notifier.rb` | systemd watchdog 心跳发送 | +| `config.rb` | 可调参数配置 | | `minesentinel.service` | systemd 单元文件(独立源码) | ## 完整文档
参数文件默认
初始宽限期main.rb31300 s
检测间隔main.rb691.5 s
冷却期main.rb58200 s
初始宽限期config.rb1300 s
冷却期config.rb3200 s
尝试次数config.rb23 次
检测间隔main.rb901.5 s
systemctl 超时method_executor.rb1730 s
最大重试method_executor.rb2310 次
检测端口server_status_detector.rb6025565