Created
July 2, 2014 10:55
-
-
Save deependersingla/0bff3fad61510a1d22a5 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Sidekiq interaction and startup script | |
commands: | |
create_post_dir: | |
command: "mkdir /opt/elasticbeanstalk/hooks/appdeploy/post" | |
ignoreErrors: true | |
files: | |
"/opt/elasticbeanstalk/hooks/appdeploy/post/50_restart_sidekiq": | |
mode: "000755" | |
content: | | |
#!/bin/bash | |
. /opt/elasticbeanstalk/containerfiles/envvars | |
PIDFILE=$EB_CONFIG_APP_PIDS/sidekiq.pid | |
cd $EB_CONFIG_APP_CURRENT | |
if [ -f $PIDFILE ] | |
then | |
SIDEKIQ_LIVES=$(/bin/ps -o pid= -p `cat $PIDFILE`) | |
if [ -z $SIDEKIQ_LIVES ] | |
then | |
rm -rf $PIDFILE | |
else | |
kill -TERM `cat $PIDFILE` | |
sleep 10 | |
rm -rf $PIDFILE | |
fi | |
fi | |
BUNDLE=/usr/local/bin/bundle | |
SIDEKIQ=/usr/local/bin/sidekiq | |
$BUNDLE exec $SIDEKIQ \ | |
-e production \ | |
-P /var/app/containerfiles/pids/sidekiq.pid \ | |
-L /var/app/containerfiles/logs/sidekiq.log \ | |
-q default -q paperclip | |
-d | |
"/opt/elasticbeanstalk/hooks/appdeploy/pre/03_mute_sidekiq": | |
mode: "000755" | |
content: | | |
#!/bin/bash | |
. /opt/elasticbeanstalk/containerfiles/envvars | |
PIDFILE=$EB_CONFIG_APP_PIDS/sidekiq.pid | |
if [ -f $PIDFILE ] | |
then | |
SIDEKIQ_LIVES=$(/bin/ps -o pid= -p `cat $PIDFILE`) | |
if [ -z $SIDEKIQ_LIVES ] | |
then | |
rm -rf $PIDFILE | |
else | |
kill -USR1 `cat $PIDFILE` | |
sleep 10 | |
fi | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment