|
|
@@ -163,26 +163,65 @@ sudo journalctl -u vmess-domain-rotator.service -n 120 --no-pager
|
|
|
sudo bash scripts/install_debian.sh [options]
|
|
|
```
|
|
|
|
|
|
-| 参数 | 说明 | 默认值 |
|
|
|
-|---|---|---|
|
|
|
-| `--user <name>` | 指定 service 用户 | 当前 `sudo` 用户 |
|
|
|
-| `--group <name>` | 指定 service 用户组 | 当前 `sudo` 用户主组 |
|
|
|
-| `--interval <value>` | 定时周期(如 `1h`/`5min`) | `1h` |
|
|
|
-| `--git-push <0|1>` | 是否自动 push | `1` |
|
|
|
-| `--git-push-remote <name>` | 远程名 | `origin` |
|
|
|
-| `--git-http-username <u>` | HTTPS 认证用户名 | `git` |
|
|
|
-| `--git-http-token <t>` | HTTPS token(明文参数) | 空 |
|
|
|
-| `--git-http-token-file <f>` | 从文件读取 token | 空 |
|
|
|
-| `--git-use-credential-store <0|1>` | 是否使用 `credential.helper store` | `1` |
|
|
|
-| `--git-credentials-file <f>` | 指定 credential store 文件路径 | 空(Git 默认) |
|
|
|
-| `--no-install-deps` | 跳过 apt 安装依赖 | 关闭 |
|
|
|
-| `-h, --help` | 查看帮助 | - |
|
|
|
+| 参数 | 说明 | 默认值 |
|
|
|
+| ------------------------------ | ------------------------------ | ------------------------------------ |
|
|
|
+| `--user <name>` | 指定 service 用户 | 当前 `sudo` 用户 |
|
|
|
+| `--group <name>` | 指定 service 用户组 | 当前 `sudo` 用户主组 |
|
|
|
+| `--interval <value>` | 定时周期(如 `1h`/`5min`) | `1h` |
|
|
|
+| `--git-push <0 | 1>` | 是否自动 push |
|
|
|
+| `--git-push-remote <name>` | 远程名 | `origin` |
|
|
|
+| `--git-http-username <u>` | HTTPS 认证用户名 | `git` |
|
|
|
+| `--git-http-token <t>` | HTTPS token(明文参数) | 空 |
|
|
|
+| `--git-http-token-file <f>` | 从文件读取 token | 空 |
|
|
|
+| `--git-use-credential-store <0 | 1>` | 是否使用 `credential.helper store` |
|
|
|
+| `--git-credentials-file <f>` | 指定 credential store 文件路径 | 空(Git 默认) |
|
|
|
+| `--no-install-deps` | 跳过 apt 安装依赖 | 关闭 |
|
|
|
+| `-h, --help` | 查看帮助 | - |
|
|
|
|
|
|
说明:
|
|
|
|
|
|
- `--git-push 1` 时,push 失败会返回非 0,systemd 任务标记失败(便于监控)。
|
|
|
- 安装会写入环境文件:`/etc/vmess-domain-rotator.env`。
|
|
|
|
|
|
+### 5.1 systemd unit 生成说明(示例)
|
|
|
+
|
|
|
+`install_debian.sh` 会按安装参数动态写入 `/etc/systemd/system/vmess-domain-rotator.service` 和 `/etc/systemd/system/vmess-domain-rotator.timer`。仓库不再维护 `systemd/*` 静态模板文件。
|
|
|
+
|
|
|
+service 示例(安装后实际内容会替换成你的参数):
|
|
|
+
|
|
|
+```ini
|
|
|
+[Unit]
|
|
|
+Description=VMess Domain Rotator updater
|
|
|
+After=network-online.target
|
|
|
+Wants=network-online.target
|
|
|
+
|
|
|
+[Service]
|
|
|
+Type=oneshot
|
|
|
+User=<RUN_USER>
|
|
|
+Group=<RUN_GROUP>
|
|
|
+WorkingDirectory=<APP_DIR>
|
|
|
+EnvironmentFile=-/etc/vmess-domain-rotator.env
|
|
|
+UMask=0077
|
|
|
+ExecStart=/bin/bash <APP_DIR>/scripts/run_update_and_commit.sh <APP_DIR>/config.json
|
|
|
+```
|
|
|
+
|
|
|
+timer 示例(`OnUnitActiveSec` 由 `--interval` 决定):
|
|
|
+
|
|
|
+```ini
|
|
|
+[Unit]
|
|
|
+Description=Run VMess Domain Rotator every <INTERVAL>
|
|
|
+
|
|
|
+[Timer]
|
|
|
+OnBootSec=2min
|
|
|
+OnUnitActiveSec=<INTERVAL>
|
|
|
+AccuracySec=30s
|
|
|
+Unit=vmess-domain-rotator.service
|
|
|
+Persistent=true
|
|
|
+
|
|
|
+[Install]
|
|
|
+WantedBy=timers.target
|
|
|
+```
|
|
|
+
|
|
|
---
|
|
|
|
|
|
## 6. 自动提交/推送逻辑说明
|