mattroyer / win-service-manager

Install, configure, and manage Windows services from Ruby

Home Page:http://github.com/ryancastro/srvany_manager

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

win-service-manager

by Ryan Castro (Originally by James Tucker)
http://github.com/ryancastro/win-service-manager/

Description:

Install, configure, and manage Microsoft Windows services from Ruby. Using Microsoft’s SRVany.exe from the MS Resource Toolkit, run a Ruby script as a Windows service.

Features/Probiles:

  • Turn any application into a Windows service using srvany.exe. Manage existing services.

  • Depending on how your Ruby process launches (Like rails, which uses a batch file), stopping the service may stop SRVany.exe, but leave the child batch running.

Synopsis:

#Create a new manager
sm = WinServiceManager.new(File.expand_path("srvany.exe"))
#Creat a new service.  Name, exe, arguments, directory to run from, Service description
sm.create('foo service', 'c:\ruby18\bin\rubyw', 'my_awesome_daemon.rb', 'c:\daemon', "This is my Daemon Service" )
sm.start('foo service')
sm.stop('foo service')
sm.delete('foo service')
puts sm.list

Turning a Rails 4 app into a service:

require 'win-service-manager'
service = WinServiceManager.new('c:\mc_ruby\srvany.exe')
service.create('Awesome Rails 4 service', 'c:\ruby200\bin\ruby', 'c:\ruby200\bin\rails server -e production', 'c:\projects\awesomerails', 'Rails 4 Service Description')

Requirements:

INSTALL:

  • gem install win-service-manager

LICENSE:

(The MIT License)

Copyright © 2008 James Tucker

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the ‘Software’), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED ‘AS IS’, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

About

Install, configure, and manage Windows services from Ruby

http://github.com/ryancastro/srvany_manager


Languages

Language:Ruby 100.0%