结合foreman和upstart 管理unicorn进程

Procfile:

web      bundle exec unicorn_rails -c config/unicorn.rb -E production

用foreman export 命令输出成upstart的格式

foreman export -u user  upstart ./config/upstart

-u  --  指定用户

输出到./config/upstart下面,是因为可能在/etc/init下面没有写的权限,可以通过sudo 或让系统管理员 将config/upstart下面的文件copy到/etc/init下面

这样就可以通过以下命令来启动,关闭,重启,app应用,而且在进程丢失的情况下会自动重启,在机器关闭,重启的时候会自动关闭,重启进程,这样管理进程就非常方便了

sudo start app_name

sudo stop app_name

sudo restart app_name

app_name是rails app的项目名字

原文地址:https://www.cnblogs.com/kamechen/p/2563668.html