diff --git a/APP_VERSIONS_LIST b/APP_VERSIONS_LIST index 55c539a..5799627 100644 --- a/APP_VERSIONS_LIST +++ b/APP_VERSIONS_LIST @@ -1,2 +1,3 @@ b43527c -60176fa \ No newline at end of file +60176fa +8cd942b \ No newline at end of file diff --git a/README.md b/README.md index c5e3ca8..f44e142 100644 --- a/README.md +++ b/README.md @@ -15,17 +15,17 @@ Minecraft 服务器守护进程 ```bash # 复制文件 -mkdir -p /opt/minecraft/sentinel -cp main.rb method_executor.rb server_status_detector.rb systemd_notifier.rb config.rb updates.rb /opt/minecraft/sentinel/ +mkdir -p /opt/minecraft/sentinel/src +cp src/main.rb src/method_executor.rb src/server_status_detector.rb src/systemd_notifier.rb src/config.rb src/updates.rb /opt/minecraft/sentinel/src/ # 安装 systemd 服务 -cp minesentinel.service /etc/systemd/system/ +cp src/minesentinel.service /etc/systemd/system/ systemctl daemon-reload systemctl enable minesentinel systemctl start minesentinel # 手动运行(调试用) -cd /opt/minecraft/sentinel +cd /opt/minecraft/sentinel/src ruby main.rb ``` @@ -68,7 +68,7 @@ MineSentinel 通过 `Before=minecraft.service` 确保先于 MC 启动,避免 M ## 完整文档 -参见 [DEPLOY.md](DEPLOY.md) 或 [官网](OfficialWebsite/index.html)。 +参见 [DEPLOY.md](docs/DEPLOY.md) 或 [官网](static/index.html)。 ## 许可证 diff --git a/DEPLOY.md b/docs/DEPLOY.md similarity index 87% rename from DEPLOY.md rename to docs/DEPLOY.md index c1f3391..b218f41 100644 --- a/DEPLOY.md +++ b/docs/DEPLOY.md @@ -20,12 +20,13 @@ MineSentinel 是一个 Minecraft 服务器守护进程,每 1.5 秒检测服务 ``` /opt/minecraft/sentinel/ # 推荐部署目录 -├── main.rb # 主程序入口 —— 检测循环 + 冷却期 + 初始宽限期 -├── method_executor.rb # 日志系统 + 重启逻辑 + 重试计数器 -├── server_status_detector.rb # TCP 端口检测模块 -├── systemd_notifier.rb # systemd watchdog 心跳发送 -├── config.rb # 可调参数配置 -└── updates.rb # 更新检查模块 +└── src/ # 源码目录 + ├── main.rb # 主程序入口 —— 检测循环 + 冷却期 + 初始宽限期 + ├── method_executor.rb # 日志系统 + 重启逻辑 + 重试计数器 + ├── server_status_detector.rb # TCP 端口检测模块 + ├── systemd_notifier.rb # systemd watchdog 心跳发送 + ├── config.rb # 可调参数配置 + └── updates.rb # 更新检查模块 minesentinel.service # systemd 单元文件(项目源码中) ``` @@ -37,8 +38,8 @@ minesentinel.service # systemd 单元文件(项目源码中) ### 1. 创建目录并复制文件 ```bash -mkdir -p /opt/minecraft/sentinel -cp main.rb method_executor.rb server_status_detector.rb systemd_notifier.rb config.rb updates.rb /opt/minecraft/sentinel/ +mkdir -p /opt/minecraft/sentinel/src +cp src/main.rb src/method_executor.rb src/server_status_detector.rb src/systemd_notifier.rb src/config.rb src/updates.rb /opt/minecraft/sentinel/src/ ``` ### 2. 确认 Minecraft systemd 服务存在 @@ -52,7 +53,7 @@ systemctl status minecraft ### 3. 手动测试 ```bash -cd /opt/minecraft/sentinel +cd /opt/minecraft/sentinel/src ruby main.rb # 调试模式:LOG_LEVEL=debug ruby main.rb ``` @@ -62,7 +63,7 @@ ruby main.rb 项目源码中已提供 `minesentinel.service`,直接复制: ```bash -cp minesentinel.service /etc/systemd/system/ +cp src/minesentinel.service /etc/systemd/system/ ``` 单元文件内容(`minesentinel.service`): @@ -76,8 +77,8 @@ Wants=minecraft.service [Service] Type=simple -WorkingDirectory=/opt/minecraft/sentinel -ExecStart=/usr/bin/ruby /opt/minecraft/sentinel/main.rb +WorkingDirectory=/opt/minecraft/sentinel/src +ExecStart=/usr/bin/ruby /opt/minecraft/sentinel/src/main.rb Restart=always RestartSec=10 StandardOutput=journal diff --git a/config.rb b/src/config.rb similarity index 100% rename from config.rb rename to src/config.rb diff --git a/main.rb b/src/main.rb similarity index 100% rename from main.rb rename to src/main.rb diff --git a/method_executor.rb b/src/method_executor.rb similarity index 100% rename from method_executor.rb rename to src/method_executor.rb diff --git a/minesentinel.service b/src/minesentinel.service similarity index 86% rename from minesentinel.service rename to src/minesentinel.service index 75af166..7daebec 100644 --- a/minesentinel.service +++ b/src/minesentinel.service @@ -13,8 +13,8 @@ Wants=minecraft.service [Service] Type=simple -WorkingDirectory=/opt/minecraft/sentinel -ExecStart=/usr/bin/ruby /opt/minecraft/sentinel/main.rb +WorkingDirectory=/opt/minecraft/sentinel/src +ExecStart=/usr/bin/ruby /opt/minecraft/sentinel/src/main.rb Restart=always RestartSec=10 StandardOutput=journal diff --git a/server_status_detector.rb b/src/server_status_detector.rb similarity index 100% rename from server_status_detector.rb rename to src/server_status_detector.rb diff --git a/systemd_notifier.rb b/src/systemd_notifier.rb similarity index 100% rename from systemd_notifier.rb rename to src/systemd_notifier.rb diff --git a/updates.rb b/src/updates.rb similarity index 95% rename from updates.rb rename to src/updates.rb index 43d407c..01d8775 100644 --- a/updates.rb +++ b/src/updates.rb @@ -22,7 +22,7 @@ RELEASE_SERIAL_CODE = '60176fa' # @type const CHANNEL: String CHANNEL = 'master' # @type const VERSION_LIST_URL: String -VERSION_LIST_URL = "https://raw.giteeusercontent.com/scu_team/minesentinel/#{CHANNEL}/APP_VERSIONS_LIST" +VERSION_LIST_URL = "https://raw.giteeusercontent.com/SCU_team/mine-sentinel/#{CHANNEL}/APP_VERSIONS_LIST" # @type const RECURSIVE_RETRY_DEPTH: Integer RECURSIVE_RETRY_DEPTH = 3 diff --git a/OfficialWebsite/Projects.txt b/static/Projects.txt similarity index 94% rename from OfficialWebsite/Projects.txt rename to static/Projects.txt index b2f675e..2799c75 100644 --- a/OfficialWebsite/Projects.txt +++ b/static/Projects.txt @@ -3,7 +3,7 @@ name = "MineSentinel" description = "Minecraft 服务器智能守护进程,TCP 端口检测 + 崩溃自动重启 + 防循环冷却期" repo_url = "https://gitee.com/snoware/minesentinel" demo_url = "https://swe-iss.rth1.xyz/softwares/minesentinel" -doc_url = "https://gitee.com/snoware/minesentinel/blob/master/DEPLOY.md" +doc_url = "https://gitee.com/snoware/minesentinel/blob/master/docs/DEPLOY.md" tags = ["Ruby", "Minecraft", "Server", "Monitoring", "Daemon", "SNOWARE"] [[projects]] diff --git a/OfficialWebsite/index.html b/static/index.html similarity index 97% rename from OfficialWebsite/index.html rename to static/index.html index 70a3359..de2d34e 100644 --- a/OfficialWebsite/index.html +++ b/static/index.html @@ -46,8 +46,8 @@ width: 200%; height: 200%; background: - repeating-linear-gradient(30deg, transparent, transparent 80px, rgba(255,255,255,0.03) 80px, rgba(255,255,255,0.03) 82px), - repeating-linear-gradient(-60deg, transparent, transparent 120px, rgba(255,255,255,0.04) 120px, rgba(255,255,255,0.04) 122px); + repeating-linear-gradient(30deg, transparent, transparent 80px, rgba(255,255,255,0.10) 80px, rgba(255,255,255,0.10) 82px), + repeating-linear-gradient(-60deg, transparent, transparent 120px, rgba(255,255,255,0.12) 120px, rgba(255,255,255,0.12) 122px); pointer-events: none; z-index: 0; } @@ -56,7 +56,7 @@ position: fixed; pointer-events: none; z-index: 0; - opacity: 0.06; + opacity: 0.12; } .geo-hex::before { content: ''; @@ -73,7 +73,7 @@ position: fixed; pointer-events: none; z-index: 0; - opacity: 0.05; + opacity: 0.10; } .geo-tri::before { content: ''; @@ -454,7 +454,7 @@

TCP 检测 · 自动重启 · 防循环冷却

SCU 团队 拥有 · 编写者 S.A. [@SNOWARE]

- 当前版本 60176fa · 频道 master + 当前版本 60176fa · 频道 master

@@ -536,19 +536,19 @@ # --depth 1 仅拉取最新提交,不下载历史记录 # --single-branch 仅拉取 master 分支

方式二:手动复制

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

3. 手动测试

-
cd /opt/minecraft/sentinel
+            
cd /opt/minecraft/sentinel/src
 ruby main.rb
 # 调试模式: LOG_LEVEL=debug ruby main.rb

4. 注册 systemd 服务

项目源码中已提供 minesentinel.service,直接复制:

-
cp minesentinel.service /etc/systemd/system/
+
cp src/minesentinel.service /etc/systemd/system/

单元文件内容:

[Unit]
 Description=MineSentinel Minecraft Server Monitor
@@ -558,8 +558,8 @@ Wants=minecraft.service
 
 [Service]
 Type=simple
-WorkingDirectory=/opt/minecraft/sentinel
-ExecStart=/usr/bin/ruby /opt/minecraft/sentinel/main.rb
+WorkingDirectory=/opt/minecraft/sentinel/src
+ExecStart=/usr/bin/ruby /opt/minecraft/sentinel/src/main.rb
 Restart=always
 RestartSec=10
 StandardOutput=journal
@@ -618,7 +618,7 @@ journalctl -u minesentinel -u minecraft -f  # 双服务合并
  • Windows:删除 root 检查,替换为 spawn "cmd /c start /B java ...",日志输出到文件
  • 监控其他服务:修改 test_port 的 IP 和端口即可
  • -

    详细适配指南见 DEPLOY.md

    +

    详细适配指南见 DEPLOY.md

    @@ -630,7 +630,7 @@ journalctl -u minesentinel -u minecraft -f # 双服务合并
    ⭐ Gitee 仓库 - 📖 完整文档 + 📖 完整文档
    @@ -648,7 +648,7 @@ journalctl -u minesentinel -u minecraft -f # 双服务合并 📋 要求: Ruby >= 3.0 · Linux (systemd) 或 Windows -

    💡 部署前请阅读 DEPLOY.md

    +

    💡 部署前请阅读 DEPLOY.md

    @@ -659,7 +659,7 @@ journalctl -u minesentinel -u minecraft -f # 双服务合并