A platform for community discussion. Free, open, simple.
Avoid hardcoded value in `unicorn_launcher` take 2.
Guo Xiang Tan16dedb5498ab
diff --git a/config/unicorn_launcher b/config/unicorn_launcherindex b2eb9b8ac8e..8ad112065c2 100755--- a/config/unicorn_launcher+++ b/config/unicorn_launcher@@ -15,9 +15,20 @@ function on_reload(){echo "Reloading unicorn"kill -s USR2 $UNICORN_PID- sleep 10+ unset NEW_UNICORN_PID++ while [ -z "$NEW_UNICORN_PID" ]; do+ NEW_UNICORN_PID=`ps -f --ppid $UNICORN_PID | grep 'unicorn master' | grep -v old | grep -v worker | awk '{ print $2 }'`+ echo "Waiting for new unicorn master pid... $NEW_UNICORN_PID"+ sleep 1+ done++ while [ -z `ps -f --ppid $NEW_UNICORN_PID | grep worker | head -1 | awk '{ print $2 }'` ]; do+ echo "Waiting for new unicorn workers to start up..."+ sleep 1+ done+curl $LOCAL_WEB &> /dev/null- NEW_UNICORN_PID=`ps -f --ppid $UNICORN_PID | grep unicorn | grep -v worker | awk '{ print $2 }'`kill -s QUIT $UNICORN_PIDecho "Old pid is: $UNICORN_PID New pid is: $NEW_UNICORN_PID"UNICORN_PID=$NEW_UNICORN_PID