我正在尝试使用monit来监视背景do进程(偶尔会被杀死),但我似乎不能看上去是工作的开始或停止命令(我只是得到“执行失败”)--尽管它们从命令提示符中工作得很好。
我没有做什么特别复杂的事:
check process backgroundrb_11006
with pidfile "/home/user/site/tmp/pids/backgroundrb_11006.pid"
start = "/usr/bin/ruby /home/user/site/script/backgroundrb start"
stop = "/usr/bin/ruby /home/user/site/script/backgroundrb stop"
if cpu > 90% for 2 cycles then restart
if totalmem > 512 MB for 2 cycles then restart
if 4 restarts within 4 cycles then timeout
group backgroundrb我为我的一些宝石(/home/user/. is /ruby/1.8/bin)定制了一个位置,我怀疑部分问题在于monit使用了一个简朴的路径(引用http://mmonit.com/monit/documentation/monit.html - PATH =/bin:/usr/bin:/sbin:/usr/sbin:/usr/sbin),使得这些宝石不可访问。另外,我在后台in调试日志中没有错误。
我希望听到任何知道我如何调整背景‘d(或我的启动/停止命令)来完成这项工作的人。
干杯沃恩。
发布于 2009-08-11 06:40:06
您可以使用正确的路径设置自定义启动/停止脚本,然后将这些脚本与monit一起使用。
非常简单的开始脚本(backgroundrb_monit_start)
#!/bin/sh
PATH=/bin:/usr/bin:/sbin:/usr/sbin:/add/your/other/paths
GEM_HOME=/home/mygemrepository
/usr/bin/ruby /home/user/site/script/backgroundrb start和monit配置:
start = "/usr/bin/ruby /home/user/site/script/backgroundrb_monit_start"https://serverfault.com/questions/52540
复制相似问题