使用Monit监控红宝石过程 [英] Monitor ruby processes with Monit
问题描述
我有一堆运行时间很长的Ruby脚本,我想确保每30秒左右启动一次.
I have a bunch of Ruby scripts which are long running, I'd like to ensure that every 30 seconds or so these are up.
我通常通过ruby script-name.rb
如何配置监控程序来照顾这些脚本?
How can I configure monit to look after these scripts?
更新:我尝试遵循此方法来创建包装脚本然后将启动ruby进程,但是它似乎没有创建.pid文件,并且键入'./wrapper-script stop'没有任何作用:/
Update: I tried to follow this method to create a wrapper script which would then launch the ruby process but it did not seem to create the .pid file and typing './wrapper-script stop' did nothing :/
我应该在ruby中编写pid还是使用包装器脚本创建monit所需的pid?
Should I write the pid inside ruby or use a wrapper script to create the pid necessary for monit?
推荐答案
Monit Wiki有很多配置示例:
The Monit Wiki has a lot of configuration examples:
http://mmonit.com/wiki/Monit/ConfigurationExamples
只需选择一个简单的,然后根据需要进行修改即可.
Just pick a simple one and modify it according to your needs.
更新:包装程序脚本应在此行中为您创建pid:
Update: the wrapper script should create the pid for you in this line:
echo $$ > /var/run/xyz.pid;
您是否根据需要调整了脚本?它可以执行(chmod +x
)吗?它具有目的地的写权限吗?也许贴出您要使用的包装器,这样我可以为您提供更多帮助.
Did you adapt the script to your needs? Is it executable (chmod +x
)? Does it have write permissions for the destination? Maybe post the wrapper you are trying to use so I can help you more.
这篇关于使用Monit监控红宝石过程的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!