run a ruby file as windows service

I have a ruby file called my_program.rb which creates a system tray icon on windows. When I do ruby my_program.rb it works fine. But I would like to make this as a windows service.

Was checking out this guide using win32/daemon and could create a windows service.

I have done everything similar to the above link except the below file :


require 'rubygems'
require 'win32/daemon'
include Win32

class TestDaemon < Daemon
  def service_main
    `ruby my_program.rb`

  def service_stop


when I run service.rb it just creates a service by my program is not running. Any Pointers will be helpful.

Thanks in advance.

Source: windows

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.