Created
March 9, 2021 04:29
-
-
Save ChunAllen/1ce9fe80a1cacf7d72f6b5576189c498 to your computer and use it in GitHub Desktop.
Restarting Puma and Delayed Job Workers
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
#!/bin/bash | |
project="myapp" | |
echo "Restarting Background Workers" | |
cd /srv/www/$project/current/ | |
RAILS_ENV=uat bin/delayed_job restart -n 5 | |
ps aux | grep 'delayed_job' |
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
#!/bin/sh | |
DATETODAY=`date '+%Y%m%d'` | |
FROM_EMAIL="noreply@example.com" | |
TO_EMAIL="user@example.com" | |
Subject="`hostname` - Start Puma @ $DATETODAY " | |
SucEmailBody="Puma is started." | |
FailEmailBody="Puma is not started. please check the log." | |
MAIL_SVR=internal-cs-smtp-clb-XXXXXXX.ap-southeast-1.elb.amazonaws.com | |
project="myapp" | |
currentpath=/srv/www/$project/current | |
echo "`date`: Starting puma..." | |
sleep 10 | |
cd $currentpath | |
bundle exec puma -C /srv/www/$project/shared/puma.rb --daemon | |
if [ $? -eq 0 ]; then | |
echo "`date '+%c'`: Puma is started. " | |
#sendemail -f $FROM_EMAIL -t $TO_EMAIL -u $Subject -m $SucEmailBody -s $MAIL_SVR:25 | |
else | |
echo "`date '+%c'`: Puma is not started. " | |
#sendemail -f $FROM_EMAIL -t $TO_EMAIL -u $Subject -m $FailEmailBody -s $MAIL_SVR:25 -a /tmp/start_puma.log | |
fi | |
echo "`date`: End" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment