1
0
Fork 0
shezmu/example/main.go

36 lines
539 B
Go
Raw Normal View History

2015-10-14 00:34:59 +00:00
package main
import (
"flag"
"io/ioutil"
"log"
"os"
"os/signal"
"github.com/localhots/uberdaemon"
"github.com/localhots/uberdaemon/example/daemons"
)
func main() {
var debug bool
flag.BoolVar(&debug, "v", false, "Verbose mode")
flag.Parse()
if !debug {
log.SetOutput(ioutil.Discard)
}
uberd := uberdaemon.New()
uberd.AddDaemon(&daemons.NumberPrinter{})
uberd.Start()
defer uberd.Stop()
sig := make(chan os.Signal)
2015-10-14 00:36:23 +00:00
signal.Notify(sig, os.Interrupt)
2015-10-14 00:34:59 +00:00
for s := range sig {
if s == os.Interrupt {
return
}
}
}