Sha256: d10806ad90a59bde08143314deaefc02f23068c515d80e0c3a8b801435ac7b20

Contents?: true

Size: 952 Bytes

Versions: 2

Compression:

Stored size: 952 Bytes

Contents

#!/bin/bash

USER="deploy"
PROJECT_PATH="<%= deploy_to %>"
NAME=delayed_job
DESC="Unicorn app for $USER"
export RAILS_ENV=production
PID="$PROJECT_PATH/shared/pids/delayed_job.pid"

case "$1" in
  start)
    CD_TO_APP_DIR="cd $PROJECT_PATH/current"
    START_DAEMON_PROCESS="bundle exec ./script/delayed_job -n 1 start"

    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

2 entries across 2 versions & 1 rubygems

Version Path
pixelforce_cms-0.9.9.9 lib/generators/pixelforce_cms/templates/recipes/templates/delayed_job_init.erb
pixelforce_cms-0.9.9.8 lib/generators/pixelforce_cms/templates/recipes/templates/delayed_job_init.erb