1

I am stuck on this problem for days, any help will be really appreciated.

Have a ruby file called app.exe which is located in "C:\MyApp\app.exe". This is a windows app which creates a system tray icon. When I click on app.exe directly this works fine. But I would like to make this as a windows service so that it is on the system tray all the time (after system boot to all users).

So I learnt that sc command in windows has some command line arguments which can be used to create a service. I am doing this :

sc create "testservice" binpath= "C:\Prevas\MyApp\app.exe" displayname= "Test Service"

And when I start :

sc start "testservice"

When I do this I get an errror :

[SC] StartService FAILED 1053:

The service did not respond to the start or control request in a timely fashion.

Not able to understand the reason why I am seeing this error, as I am able to kick start the app directly. Any parameters I am missing or anything I am doing wrong?

Thanks guys

Supersonic
  • 430
  • 1
  • 11
  • 35
  • [SC won't do the trick by itself](http://stackoverflow.com/questions/10061191/how-to-add-nginx-exe-as-windows-system-service-like-apache/12964345#12964345); you need a service wrapper. – CoreTech Jun 30 '15 at 11:19

1 Answers1

2

You should have a look at this question.
Check out Win32Utils - Ruby library for MS Windows.

From the doc,

Note that some libraries, such as win32-api and win32-service, have gems that contain prebuilt binaries so no compiler is necessary for those libraries. Just install them as you would any other gem.

There are some nice wrappers for these Utils. win32-service is one such gem will help you to acheive that.

Go through these Create a Windows Service with Ruby Part 1 , Part 2 articles by Steve Johnson.

Community
  • 1
  • 1
BinaryMee
  • 2,102
  • 5
  • 27
  • 46