Sha256: abf7f2744b3a06d1956261ca3a8d3eeda9b667e2d29596a4421b971f44f8adbc

Contents?: true

Size: 1.54 KB

Versions: 21

Compression:

Stored size: 1.54 KB

Contents

#!/bin/bash

### BEGIN INIT INFO
# Provides:          resque scheduler
# 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: resque scheduler worker via init.d
# Description:       starts resque scheduler
### END INIT INFO

USER="<%= fetch(:user) %>"
PROJECT_PATH="<%= fetch(:deploy_to) %>"
NAME="resque_scheduler"
DESC="Resque Scheduler for $USER"
PID="$PROJECT_PATH/shared/pids/resque_scheduler.pid"
LOGFILE="$PROJECT_PATH/shared/log/resque.log"
CD_TO_APP_DIR="cd $PROJECT_PATH/current"


case "$1" in
  start)
        START_DAEMON_PROCESS="bundle exec rake RAILS_ENV=<%= fetch(:rails_env) %> QUEUE='*' PIDFILE=$PID BACKGROUND=yes environment resque:scheduler 2>&1 > $LOGFILE"
        echo -n "Starting $DESC: "
        if [ `whoami` = 'root' ]; then
          su - $USER -c "$CD_TO_APP_DIR > /dev/null 2>&1 && $START_DAEMON_PROCESS"
        else
          /bin/bash -l -c "$CD_TO_APP_DIR > /dev/null 2>&1 && $START_DAEMON_PROCESS"
        fi
        echo "$NAME."
        ;;
  stop)
        STOP_DAEMON_PROCESS="test -f $PID && kill -s QUIT `cat $PID` && rm -f $PID"
        echo -n "Stopping $DESC: "
        if [ `whoami` = 'root' ]; then
          su - $USER -c "$CD_TO_APP_DIR && $STOP_DAEMON_PROCESS"
        else
          /bin/bash -l -c "$CD_TO_APP_DIR && $STOP_DAEMON_PROCESS"
        fi
        echo "$NAME."
        ;;
  *)
        echo "Usage: $NAME {start|stop|restart|reload}" >&2
        exit 1
        ;;
esac

exit 0

Version data entries

21 entries across 21 versions & 3 rubygems

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