diff options
author | kali kaneko (leap communications) <kali@leap.se> | 2020-04-22 23:52:04 +0200 |
---|---|---|
committer | kali kaneko (leap communications) <kali@leap.se> | 2020-04-30 22:10:27 +0200 |
commit | e05f5aa352f6ba55562a0afade0fa9046aeaf0d1 (patch) | |
tree | e225f9c4cb33cd5d0b0fb2b1c9b4a07c47d836a4 /pkg/helper/windows_service.go | |
parent | e3baef0e9e36e1b0f3e899ef8e83520004b50a29 (diff) |
[pkg] initialize service early for windows
Diffstat (limited to 'pkg/helper/windows_service.go')
-rw-r--r-- | pkg/helper/windows_service.go | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/pkg/helper/windows_service.go b/pkg/helper/windows_service.go index df79d68..3675249 100644 --- a/pkg/helper/windows_service.go +++ b/pkg/helper/windows_service.go @@ -8,6 +8,7 @@ package helper import ( "fmt" + "log" "golang.org/x/sys/windows/svc" "golang.org/x/sys/windows/svc/debug" @@ -22,13 +23,17 @@ func (m *myservice) Execute(args []string, r <-chan svc.ChangeRequest, changes c const cmdsAccepted = svc.AcceptStop | svc.AcceptShutdown | svc.AcceptPauseAndContinue changes <- svc.Status{State: svc.StartPending} changes <- svc.Status{State: svc.Running, Accepts: cmdsAccepted} - go runCommandServer(httpBindAddr) + + // defined in helper.go + // TODO should have a way to stop it -- + //go serveHTTP("localhost:7171") + log.Println("serving>>", httpServerConf.BindAddr) + go serveHTTP(httpServerConf.BindAddr) loop: for { select { case c := <-r: switch c.Cmd { - // TODO start?? case svc.Interrogate: changes <- c.CurrentStatus case svc.Stop, svc.Shutdown: @@ -44,6 +49,9 @@ loop: } func runService(name string, isDebug bool) { + + log.Println("Running service...") + var err error if isDebug { elog = debug.New(name) |