Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Windows service using nssm is working but not working with windows SC

I was supposed to convert a GoLang compiled file .exe as a service in windows but as the service was executed with 9 parameters from outside so I decided to use SC to make the .exe as a service and my syntax was ,

sc create myservice binPath= "\"PATH\file.exe\" -param1=value -param2=value -param3=value...-param9=value" displayname= "MyServer"  start= auto

the service created successfully but when I try to start it, it fails with "service did not respond in a timely fashion" ..

But When I created the same service with nssm syntax ,

nssm install myservice "PATH\file.exe" -param1=value -param2=value -param3=value...-param9=value

It was working and I was getting response from my service , I don't know whether the problem is with the syntax in SC or my service...

I even tried many possible ways like removing \" and giving parameters directly like binPath= "PATH/file.exe -param1=value -param2=value...param9=value" but it didn't work and I also tried to pass the parameters inside quotes , It didn't work either :( Any help would be appreciated.

like image 778
Kamikaze Avatar asked Oct 31 '25 00:10

Kamikaze


1 Answers

While SC will happily install any executable as a windows service, it should only be used to install executables that are already Windows Services. If you use SC to install a regular exe, your service will fail with Error 1053 when you try to start it. Your Go exe, which does not implement the Windows Service interface, falls victim to this situation.

like image 148
CoreTech Avatar answered Nov 01 '25 16:11

CoreTech



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!