好吧,我有这个工作了(从luislavena自己一点帮助 - 感谢)。
从https://github.com/luislavena/service_wrapper/downloads下载service_wrapper-0.1.0-win32.zip并从bin /中提取service_wrapper.exe。我将它解压到C:\ service_wrapper。
接下来设置一个配置文件。我使用了hello示例,并将其修改为我的应用程序,然后将其放在C:\ service_wrapper目录中。
; Service section, it will be the only section read by service_wrapper
[service]
; Provide full path to executable to avoid issues when executable path was not
; added to system PATH.
executable = C:\Ruby192\bin\ruby.exe
; Provide there the arguments you will pass to executable from the command line
arguments = C:\railsapp\script\rails s -e production
; Which directory will be used when invoking executable.
; Provide a full path to the directory (not to a file)
directory = C:\railsapp
; Optionally specify a logfile where both STDOUT and STDERR of executable will
; be redirected.
; Please note that full path is also required.
logfile = C:\railsapp\log\service_wrapper.log
现在只需创建
sc create railsapp binPath= "C:\service_wrapper\service_wrapper.exe C:\service_wrapper\service_wrapper.conf" start= auto
(观看binPath后空间=开始=,不会没有他们的工作)
然后用
启动它的服务
net start railsapp
而你回家了!