diff --git a/agent.go b/agent.go index 6b5460f..0441652 100644 --- a/agent.go +++ b/agent.go @@ -2,6 +2,7 @@ package agent import ( "context" + "fmt" "github.com/jkstack/anet" "github.com/jkstack/libagent/conf" @@ -45,6 +46,8 @@ func deferCallback(name string, fn func()) { // RegisterService 注册系统服务 func RegisterService(app App) error { svc := newService(app) + fmt.Printf("service name: %s\n", app.AgentName()) + fmt.Printf("platform: %s\n", svc.Platform()) return svc.Install() } diff --git a/service.go b/service.go index 26b100d..d2e7016 100644 --- a/service.go +++ b/service.go @@ -5,4 +5,5 @@ type builtinService interface { Uninstall() error Run() error Stop() error + Platform() string } diff --git a/service_windows_386.go b/service_windows_386.go index 6a080ee..d8eaa9e 100644 --- a/service_windows_386.go +++ b/service_windows_386.go @@ -133,3 +133,7 @@ func (svr *svr) Execute(args []string, r <-chan svc.ChangeRequest, changes chan< changes <- svc.Status{State: svc.StopPending} return false, 0 } + +func (svr *svr) Platform() string { + return "windows-service" +}