因特殊环境,启动 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, 此何解??