Sha256: 98b8b066bef3eca56e1962b5b029a7fd798116dd65579c40c5dd2291eeea958a

Contents?: true

Size: 1.53 KB

Versions: 9

Compression:

Stored size: 1.53 KB

Contents

#!/bin/bash

# <%= "Start or stop #{fetch(:application)}-puma" %>
#
# Matias Hick <me@unformatt.com.ar>

### BEGIN INIT INFO
# Provides:          <%= "#{fetch(:application)}-puma" %>
# Required-Start:    $local_fs $remote_fs $syslog $network
# Required-Stop:     $local_fs $remote_fs $syslog $network
# Should-Start:
# Should-Stop:
# Default-Start:     2 3 4 5
# Default-Stop:      0 1 6
# Short-Description: <%= "Starts #{fetch(:application)}-puma" %>
# Description:       <%= "Launches #{fetch(:application)}-puma" %>
### END INIT INFO

PATH=/home/maintainer/.rbenv/shims:/home/maintainer/.rbenv/bin:$PATH
PIDFILE=<%= "#{shared_path}/pids/puma.pid" %>
export RAILS_ENV=production

getPID() {
  if [ ! -z `cat $PIDFILE 2> /dev/null` ]; then
    if [[ ! -z $(ps -ef | grep -w `cat $PIDFILE` | grep -v grep) ]]; then
      echo `cat $PIDFILE 2> /dev/null`
    fi
  fi
}

case "$1" in
  start)
    echo -ne "<%= "Starting #{fetch(:application)}-puma..." %>"

    if [ -z "$(getPID)" ]; then
      cd <%=current_path%>
      bundle exec puma -q -d -C <%= "#{shared_path}/config/puma.rb" %>

      echo "started!"
    else
      echo "is already running!"
    fi
    ;;

  stop)
    echo -ne "<%= "Stopping #{fetch(:application)}-puma..." %>"

    if [ -z "$(getPID)" ]; then
      echo "is not running!"
    else
      cd <%=current_path%>
      bundle exec pumactl -S <%= "#{shared_path}/pids/puma.state" %> stop

      echo "stopped!"
    fi
    ;;

  restart)
    $0 stop
    sleep 3
    $0 start
    ;;

  *)
    echo "usage: $0 {start|stop|restart}"
esac
exit 0

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
capistrano-unformatt-1.1 vendor/templates/puma.daemon.erb
capistrano-unformatt-1.0 vendor/templates/puma.daemon.erb
capistrano-unformatt-0.7 vendor/templates/puma.daemon.erb
capistrano-unformatt-0.6 vendor/templates/puma.daemon.erb
capistrano-unformatt-0.5 vendor/templates/puma.daemon.erb
capistrano-unformatt-0.4 vendor/templates/puma.daemon.erb
capistrano-unformatt-0.3 vendor/templates/puma.daemon.erb
capistrano-unformatt-0.2 vendor/templates/puma.daemon.erb
capistrano-unformatt-0.1 vendor/templates/puma.daemon.erb