Sha256: bcc71858ef98cab66795ec35f97ceb3b0e035d816c9cc70b9fb359b7749085ed

Contents?: true

Size: 799 Bytes

Versions: 2

Compression:

Stored size: 799 Bytes

Contents

#!/bin/bash

if [ -f tmp/pids/unicorn.pid ]; then
  unicorn_pid_file=tmp/pids/unicorn.pid
  # Someone restarted the master; wait for the new master to exit.
  PID=`cat $unicorn_pid_file`

  while kill -0 $PID; do
    sleep 2
    PID=`cat $unicorn_pid_file`
  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 $unicorn_pid_file
else
  # Run the unicorn master process (this won't return until it exits).
  bundle exec unicorn -E $RAILS_ENV -c config/unicorn.rb
fi

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
pushapp-0.1.1 templates/unicorn_upstart.erb
pushapp-0.1.0 templates/unicorn_upstart.erb