全新的进程控制动作状态机
This commit is contained in:
@@ -64,7 +64,7 @@ func main() {
|
||||
log.Printf("⚠️ 启动 frpc 失败: %v", err)
|
||||
} else {
|
||||
if status, err := pm.Status(); err == nil {
|
||||
log.Printf("✅ frpc 状态: %s", status.State)
|
||||
log.Printf("✅ frpc 状态: %s", status.Phase)
|
||||
if status.PID > 0 {
|
||||
log.Printf(" PID: %d, 端口: %d", status.PID, status.Port)
|
||||
}
|
||||
@@ -94,8 +94,8 @@ func startWatchdog(pm *process.ProcessManager) {
|
||||
continue
|
||||
}
|
||||
|
||||
if status.State != "running" {
|
||||
log.Printf("⚠️ frpc 进程已停止 (状态: %s),自动重启...", status.State)
|
||||
if status.Phase != "RUNNING" {
|
||||
log.Printf("⚠️ frpc 进程已停止 (状态: %s),自动重启...", status.Phase)
|
||||
ctx := context.Background()
|
||||
if err := pm.Start(ctx); err != nil {
|
||||
log.Printf("❌ 自动重启 frpc 失败: %v", err)
|
||||
|
||||
Reference in New Issue
Block a user