feat: adjust agent cmd docs

This commit is contained in:
engigu
2026-02-09 18:44:19 +08:00
parent f693c32554
commit e6332b8a11
2 changed files with 18 additions and 11 deletions
+16 -9
View File
@@ -99,9 +99,15 @@ func main() {
} }
func printUsage() { func printUsage() {
var binName = filepath.Base(os.Args[0])
if binName == "main" || binName == "debug" {
binName = "baihu-agent"
}
fmt.Printf(`Baihu Agent v%s fmt.Printf(`Baihu Agent v%s
用法: baihu-agent <命令> [选项] 用法:
%s <命令> [选项]
命令: 命令:
start 启动 Agent(后台运行) start 启动 Agent(后台运行)
@@ -120,14 +126,15 @@ func printUsage() {
-l, --log <file> 日志文件路径 (默认: logs/agent.log) -l, --log <file> 日志文件路径 (默认: logs/agent.log)
示例: 示例:
baihu-agent start %s start
baihu-agent run %s run
baihu-agent logs %s stop
baihu-agent start -c /etc/baihu/config.ini %s logs
baihu-agent install %s start -c /etc/baihu/config.ini
baihu-agent status %s install
baihu-agent tasks %s status
`, Version) %s tasks
`, Version, binName, binName, binName, binName, binName, binName, binName, binName, binName)
} }
// daemon 模式标记 // daemon 模式标记
+2 -2
View File
@@ -166,7 +166,7 @@ After=network.target
[Service] [Service]
Type=simple Type=simple
WorkingDirectory=%s WorkingDirectory=%s
ExecStart=%s start ExecStart=%s run
Restart=always Restart=always
RestartSec=5 RestartSec=5
@@ -213,7 +213,7 @@ func uninstallLinux() {
func installWindows(exePath, exeDir string) { func installWindows(exePath, exeDir string) {
// 使用 sc.exe 创建服务 // 使用 sc.exe 创建服务
cmd := exec.Command("sc", "create", ServiceName, cmd := exec.Command("sc", "create", ServiceName,
"binPath=", fmt.Sprintf(`"%s" start`, exePath), "binPath=", fmt.Sprintf(`"%s" run`, exePath),
"start=", "auto", "start=", "auto",
"DisplayName=", ServiceDesc) "DisplayName=", ServiceDesc)