部署 Monit 无法启动 rails

feichan · 2014年03月26日 · 最后由 TsingHan 回复于 2014年03月28日 · 2648 次阅读

因特殊环境,启动 rails 只能用rails s命令,在 monit 配置中如下:

check process rails with pidfile /home/sunny/working/project/tmp/pids/server.pid
  start program = "/home/sunny/start_rails.sh"
  stop program = "/usr/bin/kill -9 `head -n1 /home/sunny/working/project/tmp/pids/server.pid`"
  if cpu > 60% for 2 cycles then alert
  if cpu > 80% for 5 cycles then restart
  if totalmem > 200.0 MB for 5 cycles then restart
  if failed host 127.0.0.1 port 3000 protocol http
    then restart
  if 3 restarts within 5 cycles then timeout
  group server

/home/sunny/start_rails.sh中:

#!/bin/sh
cd /home/sunny/working/project
/home/sunny/.rvm/gems/ruby-1.9.3-p448/bin/rails server -p 3000 -d

在没有运行rails s的前提下,启动 monit 后并没有正常启动 rails, 在 monit 的 log 也没有 rails 的相关 log, 此何解??

start stop 后面应该是 全路径 检查一下是否是这个问题

需要 登录 后方可回复, 如果你还没有账号请 注册新账号