Skip to content

Instantly share code, notes, and snippets.

@itskingori
Forked from bhauman/delayed_job_eb_sysvinit
Last active August 13, 2016 21:13
Show Gist options
  • Save itskingori/8495399 to your computer and use it in GitHub Desktop.
Save itskingori/8495399 to your computer and use it in GitHub Desktop.
Attempt at creating a 'delayed_jobs' service on AWS EB

Delayed Jobs Service

# chkconfig: 2345 99 20
# description: Starts, restarts or stops delayed job processor
# servicename: delayed_jobs

This says that the random script should be started in levels 2, 3, 4, and 5, that its start priority should be 99, and that its stop priority should be 20. You should be able to figure out what the description says.

References:

files:
"/etc/init.d/delayed_jobs":
mode: "000755"
owner: root
group: root
content: |
!/usr/bin/env bash
# chkconfig: 2345 99 20
# description: Starts, restarts or stops delayed job processor
# su -c "RAILS_ENV=production script/delayed_job --pid-dir=$EB_CONFIG_APP_SUPPORT/pids restart" $EB_CONFIG_APP_USER
. /opt/elasticbeanstalk/support/envvars
function start() {
pushd $EB_CONFIG_APP_CURRENT
"RAILS_ENV=production script/delayed_job --pid-dir=$EB_CONFIG_APP_SUPPORT/pids start"
popd
}
function stop() {
pushd $EB_CONFIG_APP_CURRENT
"RAILS_ENV=production script/delayed_job --pid-dir=$EB_CONFIG_APP_SUPPORT/pids stop"
popd
}
case "$1" in
start)
start
;;
stop)
stop
;;
restart|reload)
stop
start
;;
*)
echo "Usage: $0 {start|stop|restart|reload|status}"
exit 1
;;
esac
exit 0
# sudo chkconfig --add delayed_jobs
# sudo chkconfig -–level 2345 delayed_jobs on
services:
sysvinit:
delayed_jobs:
enabled: true
ensureRunning: true
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment