Created
July 5, 2012 17:25
-
-
Save oelbrenner/3055040 to your computer and use it in GitHub Desktop.
delayed_job wrapper script for use with monit
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
#!/usr/bin/env bash | |
if [ $# -lt 1 ] ; then | |
echo "Usage: " $0 " <start | stop> " | |
exit 1 | |
fi | |
action=$1 | |
rails_root=`pwd` | |
logfile=$rails_root/log/monit_delayed_job.log | |
script_location=$(cd ${0%/*} && pwd -P) | |
cd $script_location/.. | |
if [ -f "/etc/profile" ]; then | |
. /etc/profile | |
fi | |
echo "-----------------------------------------------" >> $logfile 2>&1 | |
echo "Running bundle exec ./script/delayed_job $action" >> $logfile 2>&1 | |
echo `date` >> $logfile 2>&1 | |
echo `env` >> $logfile 2>&1 | |
bundle exec ./script/delayed_job $action >> $logfile 2>&1 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment