how to restart unicorn manually

狂风中的少年 提交于 2019-11-30 04:56:30

you didn't list the OS. but one of the following should work.

you will need to be root / use sudo

/etc/init.d/unicorn_myapp restart 


/etc/init.d/unicorn_myapp stop 
/etc/init.d/unicorn_myapp start 


service unicorn_myapp restart

service unicorn_myapp stop
service unicorn_myapp start

Try the restart versions first, but depending upon how the init script was written it might not have a restart command, if that doesn't work you can do the stop / start version.

Vincent Guerci

Alternatively, instead of relying on /etc/init.d... scripts which are OS dependent, a simple way to restart unicorn is to send HUP (1) signal to its master process.

Here is for instance how I reload an app automatically after a git push via post-receive hook:

#!/bin/sh
unicorn_pid=`cat /tmp/pids/unicorn.pid`
echo "Restarting Unicorn ($unicorn_pid)"
kill -HUP $unicorn_pid

In your case, /etc/init.d/unicorn_myapp restart script is probably doing this. Check the unicorn.conf for the location of its pidfile.

For more details, see unicorn SIGNALS documentations

You might have to be root, but it should just be /etc/init.d/unicorn_myapp restart (don't include run, which is not a shell command).

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!