kardianos / service

Run go programs as a service on major platforms.
zlib License
4.41k stars 671 forks source link

logging example #51

Closed joeblew99 closed 8 years ago

joeblew99 commented 8 years ago

Just testing this out. I am using your logging example because it gives interactive feedback to get me going.

My use case if that i need to start the following up on a windows machine, in the following order:

So far: I used goxc to build for windows, mac and linux. Easy.

So i have the logging binary, but not sure how to control it ???

joeblew99 commented 8 years ago

just to be clear i click the binary and i get

gedw99-MacBook-Pro:serverX_darwin_amd64 apple$ ./serverX I: 15:58:57 Running in terminal. I: 15:58:57 I'm running darwin-launchd. I: 15:58:59 Still running at 2016-02-17 15:58:59.827872251 +0100 CET... ^CI: 15:59:01 I'm Stopping!

joeblew99 commented 8 years ago

But how to tell it to install as a service and start when the machine starts up ? How to uninstall it as a service ?

kardianos commented 8 years ago

I would recommend reading https://godoc.org/github.com/kardianos/service , esp read https://godoc.org/github.com/kardianos/service#Service and https://godoc.org/github.com/kardianos/service#Control

Try using the -service flag in that example: https://github.com/kardianos/service/blob/master/example/logging/main.go#L63

joeblew99 commented 8 years ago

ok that makes sense - should have seen that :) thanks @kardianos