Sha256: e1c831a32cc38b229f14125d23f1a7512639f801e9505f44638d5d6e1c01b87d
Contents?: true
Size: 1.01 KB
Versions: 19
Compression:
Stored size: 1.01 KB
Contents
#!/bin/bash unicorn_pid_file=tmp/pids/unicorn.pid if [ -f $unicorn_pid_file ]; then # Someone restarted the master; wait for the new master to exit. function graceful_shutdown { echo "Initializing graceful shutdown" kill -QUIT `cat $unicorn_pid_file` # Git unicorn some time to stop sleep 1 } # Trap upstart stop (TERM) and send QUIT to unicorn trap graceful_shutdown TERM while [ -f $unicorn_pid_file ] && kill -0 `cat $unicorn_pid_file`; do sleep 2 done # If we get here, the master has exited, either because someone restarted # it again (in which case there's already a new master running), or # it died for real (in which case we'll need to start a new process). # The sleep above is a tradeoff between polling load and mimizing the # restart delay when the master dies for real (which should hopefully be # rare). rm -f $unicorn_pid_file else # Run the unicorn master process (this won't return until it exits). exec bundle exec unicorn -E $RAILS_ENV -c config/unicorn.rb fi
Version data entries
19 entries across 19 versions & 1 rubygems