| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Name | Name | Last commit date | ||
|---|---|---|---|---|
./DontCrack \ -path "/opt/DontCrack4ManyLinux/example/childproc/childproc" \ -args "-mode normal -interval 500ms -lifetime 5s" \ -env "EXTRA_INFO=from_manager RESTART_ENV_COUNT=0" \ -file-log -log-path ./example/logs/ -log-life-day 7 \ -auto-restart -max-retries 2 \ -start-now \ -password 123456
| 配置项 | 类型 | 默认值 | 说明 |
|---|---|---|---|
| path | string | "" | 要管理的程序路径(支持可执行文件、shell脚本等) |
| args | string | "" | 传递给程序的参数(可选) |
| pre | string | "" | 启动前要执行的命令(在 sh 中执行,可用&&/;/ |
| env | string | "" | 为子进程追加环境变量,如: "PATH=/usr/local/bin:/usr/bin FOO=bar";用空格或分号分隔 |
| auto-restart | bool | false | 是否自动重启 |
| max-retries | int | 3 | 最大重试次数(-1表示无限次,默认3次) |
| start-now | bool | false | 是否立即启动 |
| password | string | "" | 管理进程的密码(可选,默认为空且不开启密码保护) |
| port | int | 11883 | HTTP服务端口 |
| log-capacity | int | 200 | 日志缓存的最大行数(默认200) |
| log-max-line-bytes | int | 1048576 | 单行日志的最大字节数(用于bufio.Scanner,默认1MiB) |
| file-log | bool | false | 是否启用文件日志(默认false) |
| log-path | string | ./logs/proc_manager/ | 本地日志文件目录(默认 ./logs/proc_manager/,按进程名创建子目录) |
| log-life-day | int | 7 | 本地日志文件保存天数(默认7天,新日志写入时会清理过期文件) |
/startup
password: 密钥(可选params参数)
ok
/heartbeat
password: 密钥(可选params参数)
{
"version": "1.0.20260826",
"state": "stopped",
"info": "进程管理器正常运行",
"timestamp": "2026-08-25 15:28:04",
"logs": [
"[STDERR] 2026/08/25 15:27:55.647714 env restart count -> 1",
"[STDERR] 2026/08/25 15:27:55.648316 childproc start | pid=32054 | mode=normal | interval=1s | lifetime=5s | msg=",
"[STDERR] 2026/08/25 15:27:55.648345 args: /opt/.../childproc -mode normal -interval 1s -lifetime 5s",
"[STDERR] 2026/08/25 15:27:55.648352 env EXTRA_INFO=from_manager",
"[STDERR] 2026/08/25 15:27:55.648353 env RESTART_ENV_COUNT=0",
"[STDERR] 2026/08/25 15:27:56.668982 tick at 2026-08-25T15:27:56.64879725+08:00",
"[STDERR] 2026/08/25 15:28:00.686300 lifetime reached, exiting normally"
],
"process_pid": 0,
"process_path": "/opt/.../childproc",
"restart_count": 0,
"file_type": "binary_executable",
"last_exit_time": "2026-08-25 15:28:00",
"program_args": "-mode normal -interval 1s -lifetime 5s",
"extra_env_raw": "PATH=/usr/local/bin EXTRA_INFO=from_manager RESTART_ENV_COUNT=0"
}
/shutdown
password: 密钥(可选params参数)
ok
将编译好的 DontCrack 放到 /usr/local/bin/,然后把示例 service 复制到 /etc/systemd/system/:
sudo cp example/dontcrack-edgecore.service /etc/systemd/system/
sudo systemctl daemon-reload
sudo systemctl enable --now dontcrack-edgecore.service
sudo systemctl status dontcrack-edgecore完整示例见 example/dontcrack-edgecore.service,记得按实际情况调整 ExecStart 中的路径、端口、预处理脚本等参数。
| Back | FazBrowse Home | New Git URL |