Sha256: 38a87ea8eddfabc4bbdfcb8df1e198d7eb8e7aa519f084781f4ce43d234c9870

Contents?: true

Size: 1.33 KB

Versions: 5

Compression:

Stored size: 1.33 KB

Contents

#!/bin/bash

### BEGIN INIT INFO
# Provides:          puma
# 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 puma web server
# Description:       starts puma
### END INIT INFO

USER="<%= user %>"
DAEMON=puma
PROJECT_PATH="<%= deploy_to %>"
DAEMON_OPTS="-e <%= rails_env %>"
NAME=puma
DESC="puma app for $USER"
PID="$PROJECT_PATH/shared/pids/puma.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

5 entries across 5 versions & 1 rubygems

Version Path
pixelforce_recipes-1.1 lib/pixelforce_recipes/templates/puma_init.erb
pixelforce_recipes-1.0 lib/pixelforce_recipes/templates/puma_init.erb
pixelforce_recipes-0.9 lib/pixelforce_recipes/templates/puma_init.erb
pixelforce_recipes-0.8 lib/pixelforce_recipes/templates/puma_init.erb
pixelforce_recipes-0.7 lib/pixelforce_recipes/templates/puma_init.erb