Skip to content

Instantly share code, notes, and snippets.

@evopix
Created October 20, 2012 01:38
Show Gist options
  • Save evopix/3921634 to your computer and use it in GitHub Desktop.
Save evopix/3921634 to your computer and use it in GitHub Desktop.

Revisions

  1. evopix revised this gist Oct 26, 2012. 1 changed file with 3 additions and 3 deletions.
    6 changes: 3 additions & 3 deletions php-resque
    Original file line number Diff line number Diff line change
    @@ -13,7 +13,7 @@

    set -e

    NAME="php-resque"
    ENV="development"
    ROOT="/vagrant"
    QUEUES="*"
    COUNT=2
    @@ -28,7 +28,7 @@ start() {

    program="$MINION"
    options="$TASK"
    options="$options --resque=$QUEUES --count=$COUNT --verbose=$VERBOSE"
    options="$options --resque=$QUEUES --count=$COUNT --verbose=$VERBOSE --env=$ENV"
    cd $ROOT

    echo "Starting $NAME workers ..."
    @@ -42,7 +42,7 @@ stop() {

    program="$MINION"
    options="$TASK"
    options="$options --shutdown"
    options="$options --shutdown --env=$ENV"

    cd $ROOT
    echo "Stopping $NAME workers ..."
  2. evopix created this gist Oct 20, 2012.
    71 changes: 71 additions & 0 deletions php-resque
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,71 @@
    #!/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

    NAME="php-resque"
    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"
    cd $ROOT

    echo "Starting $NAME workers ..."
    $program $options >> /dev/null

    }

    stop() {
    local program
    local options

    program="$MINION"
    options="$TASK"
    options="$options --shutdown"

    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