Skip to content

Commit

Permalink
Allow assigning local default values via /etc/default or /etc/sysconfig.
Browse files Browse the repository at this point in the history
  • Loading branch information
Rob Chekaluk committed Dec 26, 2013
1 parent 9c7eda5 commit fee3301
Showing 1 changed file with 15 additions and 9 deletions.
24 changes: 15 additions & 9 deletions examples/chef/cookbooks/sidekiq/templates/default/sidekiq.erb
Original file line number Diff line number Diff line change
Expand Up @@ -96,8 +96,22 @@ fi

#Baisc Setup of default values
APP=$1 ; ACTION=$2; RACK_ENV=$3; CONF_FILE=$4;
APP_HOME="/data"
SIDEKIQ="sidekiq"

WORKER_REF=`echo $CONF_FILE | sed s/.yml//`

APP_DIR="/data/${APP}"
LOCK_FILE="/tmp/$WORKER_REF.monit-lock"
PID_FILE="/var/run/engineyard/sidekiq/$APP/$WORKER_REF.pid"

# Read other defaults from a file
if [ -r /etc/default/$WORKER_REF ]; then
. /etc/default/$WORKER_REF
elif [ -r /etc/sysconfig/$WORKER_REF ]; then
. /etc/sysconfig/$WORKER_REF
fi

APP_DIR="${APP_HOME}/${APP}"
APP_ROOT="${APP_DIR}/current"
APP_SHARED="${APP_DIR}/shared"
APP_CONFIG="${APP_SHARED}/config"
Expand All @@ -109,15 +123,7 @@ else
exit 1
fi

WORKER_REF=`echo $CONF_FILE | sed s/.yml//`
LOG_FILE="$APP_ROOT/log/$WORKER_REF.log"
LOCK_FILE="/tmp/$WORKER_REF.monit-lock"
PID_FILE="/var/run/engineyard/sidekiq/$APP/$WORKER_REF.pid"
GEMFILE="$APP_ROOT/Gemfile"
SIDEKIQ="sidekiq"
if [ -f $GEMFILE ];then
SIDEKIQ="$APP_ROOT/ey_bundler_binstubs/sidekiq"
fi

if [ -d $APP_ROOT ]; then
USER=$(stat -L -c"%U" $APP_ROOT)
Expand Down

0 comments on commit fee3301

Please sign in to comment.