Sha256: d1db56f2af36f23047f9574fbab87f3ba0ea7099d821d8d2bcde1fa6cac510b4

Contents?: true

Size: 1.2 KB

Versions: 21

Compression:

Stored size: 1.2 KB

Contents

#!/bin/bash
export HOME=<%= deploy_to %>
source <%= deploy_to %>/.rvm/scripts/rvm
export RAILS_ENV=<%= rails_env %>

PIDFILE=<%= shared_path %>/pids/unicorn.pid
CONFIG=<%= shared_path %>/config/unicorn.rb
CMD="bundle exec unicorn -c $CONFIG -E $RAILS_ENV -D config.ru"

cd <%= current_path %> >/dev/null

sig () {
  test -s "$PIDFILE" && kill -$1 $(<$PIDFILE)
}

case $1 in
start)
  sig 0 && echo >&2 "Already running" && exit 0
  $CMD
  ;;
stop)
  sig QUIT && exit 0
  echo >&2 "Not running"
  ;;
kill)
  sig TERM && exit 0
  echo >&2 "Not running"
  ;;
reload)
  sig HUP && echo reloaded OK && exit 0
  echo >&2 "Couldn't reload, starting '$CMD' instead"
  $CMD
  ;;
upgrade)
  sig USR2 && exit 0
  echo >&2 "Couldn't upgrade, starting '$CMD' instead"
  $CMD
  ;;
addworker)
  sig TTIN && echo added one worker to the pool OK && exit 0
  echo >&2 "Couldn't add worker" && exit 1
  ;;
delworker)
  sig TTOU && echo removed one worker from the pool OK && exit 0
  echo >&2 "Couldn't remove worker" && exit 1
  ;;
logrotate)
  sig USR1 && echo rotated logs OK && exit 0
  echo >&2 "Couldn't rotate logs" && exit 1
  ;;
*)
  echo >&2 "Usage: $0 <start|stop|kill|reload|upgrade|addworker|delworker|logrotate>"
  exit 1
  ;;
esac

Version data entries

21 entries across 21 versions & 1 rubygems

Version Path
capper-0.7.3 lib/capper/templates/unicorn.sh.erb
capper-0.7.2 lib/capper/templates/unicorn.sh.erb
capper-0.7.1 lib/capper/templates/unicorn.sh.erb
capper-0.7.0 lib/capper/templates/unicorn.sh.erb
capper-0.6.8 lib/capper/templates/unicorn.sh.erb
capper-0.6.7 lib/capper/templates/unicorn.sh.erb
capper-0.6.6 lib/capper/templates/unicorn.sh.erb
capper-0.6.5 lib/capper/templates/unicorn.sh.erb
capper-0.6.4 lib/capper/templates/unicorn.sh.erb
capper-0.6.3 lib/capper/templates/unicorn.sh.erb
capper-0.6.2 lib/capper/templates/unicorn.sh.erb
capper-0.6.1 lib/capper/templates/unicorn.sh.erb
capper-0.6.0 lib/capper/templates/unicorn.sh.erb
capper-0.5.0 lib/capper/templates/unicorn.sh.erb
capper-0.4.0 lib/capper/templates/unicorn.sh.erb
capper-0.3.6 lib/capper/templates/unicorn.sh.erb
capper-0.3.5 lib/capper/templates/unicorn.sh.erb
capper-0.3.4 lib/capper/templates/unicorn.sh.erb
capper-0.3.3 lib/capper/templates/unicorn.sh.erb
capper-0.3.2 lib/capper/templates/unicorn.sh.erb