Sha256: 0830301de38bcb9dedbe0c307ca0a718247102c1d69d80baea1e0677d1f19306

Contents?: true

Size: 1.35 KB

Versions: 1

Compression:

Stored size: 1.35 KB

Contents

#!/bin/bash

### BEGIN INIT INFO
# Provides:          sidekiq
# 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: starts the sidekiq web server
# Description:       starts sidekiq
### END INIT INFO

USER="deploy"
DAEMON=sidekiq
PROJECT_PATH="<%= deploy_to %>"
NAME=sidekiq
DESC="Sidekiq app for $USER"
PID="$PROJECT_PATH/shared/pids/sidekiq.pid"
LOGFILE="$PROJECT_PATH/shared/log/sidekiq.log"
CD_TO_APP_DIR="cd $PROJECT_PATH/current"

case "$1" in
  start)
        START_DAEMON_PROCESS="bundle exec sidekiq -d -e <%= rails_env %> -L $LOGFILE -P $PID"

        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: "
        if [ `whoami` = 'root' ]; then
          su - $USER -c "$CD_TO_APP_DIR && bundle exec sidekiqctl stop $PID 60"
        else
          /bin/bash -l -c "$CD_TO_APP_DIR && bundle exec sidekiqctl stop $PID 60"
        fi
        echo "$NAME."
        ;;  
  *)
        echo "Usage: $NAME {start|stop|restart|reload}" >&2
        exit 1
        ;;
esac

exit 0

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
pixelforce_recipes-1.3 lib/pixelforce_recipes/templates/sidekiq_init.erb