红宝石不会以暴发户开始或停止

时间:2014-02-19 22:19:38

标签: ruby-on-rails ubuntu rvm upstart

包装器脚本独立工作,但我不能通过upstart停止或启动该过程。 ubuntu停止并开始挂起,我期待守护进程进行pid跟踪,因为它有自己的pid文件。

/etc/init/tracks.conf:

start on runlevel [2345] and started networking
stop on runlevel [!2345] or stopped networking

author "Root <root@localhost>"

description "tracks wrapper for upstart"

expect daemon

exec sudo -u ubuntu /usr/local/bin/tracks >> /home/ubuntu/tracks/log/upstart.log 2>&1

respawn
respawn limit 1 10

/ usr / local / bin / tracks包装器脚本:

#!/bin/bash
source /etc/profile.d/rvm.sh
export rvmsudo_secure_path=1
cd /home/ubuntu/tracks && /usr/local/rvm/bin/rvmsudo bundle exec rails server -e production -p 80 -d

1 个答案:

答案 0 :(得分:1)

这修复了/etc/init/tracks.conf

start on runlevel [2345] and started networking
stop on runlevel [!2345] or stopped networking

author "Root <root@localhost>"

description "tracks wrapper for upstart"

chdir /home/ubuntu/tracks

pre-start script
    exec sudo -u ubuntu "/usr/local/bin/tracks"
end script

post-stop exec kill -9 `cat /home/ubuntu/tracks/tmp/pids/server.pid`