简体   繁体   English

在Ubuntu / Monit中将Mailman脚本作为服务运行

[英]Running Mailman script as a service in Ubuntu/Monit

I have setup a mailman script in my rails app to download and process emails. 我已经在Rails应用程序中设置了一个邮递员脚本,以下载和处理电子邮件。 This is working fine. 一切正常。

The script is located in the scripts directory of the rails app. 该脚本位于rails应用程序的scripts目录中。

I need this script to run upon deployment, via monit (which I am using for other services). 我需要此脚本通过monit(用于其他服务)在部署时运行。

I am not sure how to configure monit to run this particular script (as it has no start/stop functions etc). 我不确定如何配置监控程序来运行此特定脚本(因为它没有启动/停止功能等)。

Using Ubuntu 12.04 on the server. 在服务器上使用Ubuntu 12.04。

Pretty outdated question, but in case somebody is looking for the same - you can use gem Daemons and create a wrapper script, something like: 这个问题已经过时了,但是如果有人在寻找相同的问题,您可以使用gem Daemon并创建包装脚本,例如:

#!/usr/bin/env ruby
require 'daemons'

Daemons.run('script/mailman_server')

Then you get start and stop commands and can do: 然后,您将获得startstop命令,并可以执行以下操作:

bundle exec script/mailman_daemon start

and

bundle exec script/mailman_daemon stop

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM