func daemon() error { service, err := docker.NewServer() if err != nil { return err } return rcli.ListenAndServe("tcp", "127.0.0.1:4242", service) }
func daemon(pidfile string) error { if err := createPidFile(pidfile); err != nil { log.Fatal(err) } defer removePidFile(pidfile) c := make(chan os.Signal, 1) signal.Notify(c, os.Interrupt, os.Kill, os.Signal(syscall.SIGTERM)) go func() { sig := <-c log.Printf("Received signal '%v', exiting\n", sig) removePidFile(pidfile) os.Exit(0) }() service, err := docker.NewServer() if err != nil { return err } return rcli.ListenAndServe("tcp", "127.0.0.1:4242", service) }