#!/bin/sh -e ### BEGIN INIT INFO # Provides: php-resque # Required-Start: $local_fs $remote_fs # Required-Stop: $local_fs $remote_fs # Should-Start: $local_fs # Should-Stop: $local_fs # Default-Start: 2 3 4 5 # Default-Stop: 0 1 6 # Short-Description: resque - a Redis-backed PHP library for creating background jobs # Description: resque - a Redis-backed PHP library for creating background jobs, placing those jobs on multiple queues, and processing them later. ### END INIT INFO set -e ENV="development" ROOT="/vagrant" QUEUES="*" COUNT=2 VERBOSE=1 MINION="$ROOT/minion" TASK="resque" start() { local program local options program="$MINION" options="$TASK" options="$options --resque=$QUEUES --count=$COUNT --verbose=$VERBOSE --env=$ENV" cd $ROOT echo "Starting $NAME workers ..." $program $options >> /dev/null } stop() { local program local options program="$MINION" options="$TASK" options="$options --shutdown --env=$ENV" cd $ROOT echo "Stopping $NAME workers ..." $program $options } case "$1" in start) start ;; stop) stop ;; restart) stop sleep 1 start ;; *) echo "Usage: $0 {start|stop|restart}" >&2 exit 1 ;; esac