kardianos / service

Run go programs as a service on major platforms.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Windows 10 : service install / service start - "The parameter is incorrect."

Keunho77 opened this issue · comments

I'm testing the logging example, but when I start the service, "The parameter is incorrect." error occurs.
The execution environment is the Administrator terminal of Windows 10 Pro.

I deleted the Dependencies item referring to issue #173 like as below.

func main() {
	svcFlag := flag.String("service", "", "Control the system service.")
	flag.Parse()
	options := make(service.KeyValue)
	options["Restart"] = "on-success"
	options["SuccessExitStatus"] = "1 2 8 SIGKILL"
	svcConfig := &service.Config{
		Name:        "GoServiceExampleLogging",
		DisplayName: "Go Service Example for Logging",
		Description: "This is an example Go service that outputs log messages.",
		// Dependencies: []string{
		// 	"Requires=network.target",
		// 	"After=network-online.target syslog.target"},
		Option: options,
	}

Below is the execution log

C:\test\service\example\logging>main.exe -service install

C:\test\service\example\logging>main.exe -service start
2022/06/03 14:21:06 Valid actions: ["start" "stop" "restart" "install" "uninstall"]
2022/06/03 14:21:06 Failed to start Go Service Example for Logging: The parameter is incorrect.

thanks for the advice in advance

This should be solved. I'll tag a new release soon.