From 0a6adea9abd5d22148b36224ed72d4b4c5b823ce Mon Sep 17 00:00:00 2001 From: UUBulb <35923940+uubulb@users.noreply.github.com> Date: Sat, 20 Jul 2024 19:01:11 +0800 Subject: [PATCH] fix: add recovery option for windows service (#41) --- cmd/agent/main.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/cmd/agent/main.go b/cmd/agent/main.go index e719064a..9dfe4b96 100644 --- a/cmd/agent/main.go +++ b/cmd/agent/main.go @@ -299,12 +299,17 @@ func runService(action string, flags []string) { return } + winConfig := map[string]interface{}{ + "OnFailure": "restart", + } + svcConfig := &service.Config{ Name: "nezha-agent", DisplayName: "Nezha Agent", Description: "哪吒探针监控端", Arguments: flags, WorkingDirectory: dir, + Option: winConfig, } prg := &program{