Skip to content

Instantly share code, notes, and snippets.

@oelbrenner
Created July 5, 2012 17:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save oelbrenner/3055040 to your computer and use it in GitHub Desktop.
Save oelbrenner/3055040 to your computer and use it in GitHub Desktop.
delayed_job wrapper script for use with monit
#!/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