Skip to content

Instantly share code, notes, and snippets.

@t2ynkmr
Created October 8, 2013 02:18
Show Gist options
  • Save t2ynkmr/6878390 to your computer and use it in GitHub Desktop.
Save t2ynkmr/6878390 to your computer and use it in GitHub Desktop.
unicorn を upstart 管理することに悩んだが、一旦解決したのでメモ。
description "myapp"
start on runlevel [2345]
stop on runlevel [!2345]
respawn
respawn limit 5 60
console log
setuid hoge
setgid hoge
env APP_HOME=/hoge/hoge
pre-start script
export PATH=/home/hoge/.rbenv/shims:$PATH
export RBENV_ROOT=/home/hoge/.rbenv
export RAILS_ENV=production
exec bundle exec unicorn_rails -c config/unicorn.rb -E $RAILS_ENV -D
end script
post-stop script
exec kill -s QUIT `cat $APP_HOME/tmp/pids/unicorn.pid`
end script
@t2ynkmr
Copy link
Author

t2ynkmr commented Oct 8, 2013

ただ、プロセスを initctl 経由せずに停止させた場合に、 status が runninng のまま残っちゃう問題が。。。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment