Sha256: 42ee3db9ae6aead3eefe69f1c838f6b8c80af87607ff2731106cdac26a67a246

Contents?: true

Size: 1.44 KB

Versions: 24

Compression:

Stored size: 1.44 KB

Contents

#!/bin/bash

### BEGIN INIT INFO
# Provides:          <%= fetch(:application) %>
# Required-Start:    $local_fs $remote_fs $network $syslog
# Required-Stop:     $local_fs $remote_fs $network $syslog
# Default-Start:     2 3 4 5
# Default-Stop:      0 1 6
# Short-Description: starts the unicorn web server
# Description:       starts unicorn
### END INIT INFO

USER="<%= fetch(:user) %>"
DAEMON=unicorn
PROJECT_PATH="<%= fetch(:deploy_to) %>"
DAEMON_OPTS="-c $PROJECT_PATH/current/config/unicorn.rb -E <%= fetch(:rails_env) %> -D"
NAME=unicorn
DESC="Unicorn app for $USER"
PID="$PROJECT_PATH/shared/pids/unicorn.pid"

case "$1" in
  start)
        CD_TO_APP_DIR="cd $PROJECT_PATH/current"
        START_DAEMON_PROCESS="bundle exec $DAEMON $DAEMON_OPTS"

        echo -n "Starting $DESC: "
        if [ `whoami` = 'root' ]; then
          su - $USER -c "$CD_TO_APP_DIR > /dev/null 2>&1 && $START_DAEMON_PROCESS"
        else
          $CD_TO_APP_DIR > /dev/null 2>&1 && $START_DAEMON_PROCESS
        fi
        echo "$NAME."
        ;;
  stop)
        echo -n "Stopping $DESC: "
        kill -QUIT `cat $PID`
        echo "$NAME."
        ;;
  restart)
        echo -n "Restarting $DESC: "
        kill -USR2 `cat $PID`
        echo "$NAME."
        ;;
  reload)
        echo -n "Reloading $DESC configuration: "
        kill -HUP `cat $PID`
        echo "$NAME."
        ;;
  *)
        echo "Usage: $NAME {start|stop|restart|reload}" >&2
        exit 1
        ;;
esac

exit 0

Version data entries

24 entries across 24 versions & 3 rubygems

Version Path
pixelforce_kit-0.9 lib/pixelforce_kit/recipes/templates/unicorn_init.erb
pixelforce_kit-4.0.2 lib/pixelforce_kit/recipes/templates/unicorn_init.erb
pixelforce-kit-4.0.2 lib/pixelforce_kit/recipes/templates/unicorn_init.erb
pixelforce_recipes-4.0 lib/recipes/templates/unicorn_init.erb
pixelforce_recipes-3.9.2 lib/pixelforce_recipes/templates/unicorn_init.erb
pixelforce_recipes-3.9.1 lib/pixelforce_recipes/templates/unicorn_init.erb
pixelforce_recipes-3.9 lib/pixelforce_recipes/templates/unicorn_init.erb
pixelforce_recipes-3.8 lib/pixelforce_recipes/templates/unicorn_init.erb
pixelforce_recipes-3.7 lib/pixelforce_recipes/templates/unicorn_init.erb
pixelforce_recipes-3.6 lib/pixelforce_recipes/templates/unicorn_init.erb
pixelforce_recipes-3.5 lib/pixelforce_recipes/templates/unicorn_init.erb
pixelforce_recipes-3.4 lib/pixelforce_recipes/templates/unicorn_init.erb
pixelforce_recipes-3.3 lib/pixelforce_recipes/templates/unicorn_init.erb
pixelforce_recipes-3.2 lib/pixelforce_recipes/templates/unicorn_init.erb
pixelforce_recipes-3.1 lib/pixelforce_recipes/templates/unicorn_init.erb
pixelforce_recipes-3.0 lib/pixelforce_recipes/templates/unicorn_init.erb
pixelforce_recipes-2.4 lib/pixelforce_recipes/templates/unicorn_init.erb
pixelforce_recipes-2.3 lib/pixelforce_recipes/templates/unicorn_init.erb
pixelforce_recipes-2.1 lib/pixelforce_recipes/templates/unicorn_init.erb
pixelforce_recipes-2.0 lib/pixelforce_recipes/templates/unicorn_init.erb