Skip to content

Instantly share code, notes, and snippets.

@evblurbs
Created May 19, 2015 08:17
Show Gist options
  • Save evblurbs/dbeff30b1d4664ff5a4b to your computer and use it in GitHub Desktop.
Save evblurbs/dbeff30b1d4664ff5a4b to your computer and use it in GitHub Desktop.
Elastic Beanstalk config file for Whenever gem.
files:
"/opt/elasticbeanstalk/hooks/appdeploy/post/01_cron.sh":
mode: "000755"
owner: root
group: root
content: |
#!/usr/bin/env bash
# Using similar syntax as the appdeploy pre hooks that is managed by AWS
set -xe
EB_SCRIPT_DIR=$(/opt/elasticbeanstalk/bin/get-config container -k script_dir)
EB_SUPPORT_DIR=$(/opt/elasticbeanstalk/bin/get-config container -k support_dir)
EB_DEPLOY_DIR=$(/opt/elasticbeanstalk/bin/get-config container -k app_deploy_dir)
. $EB_SUPPORT_DIR/envvars
. $EB_SCRIPT_DIR/use-app-ruby.sh
cd $EB_DEPLOY_DIR
su -c "bundle exec whenever --update-cron"
su -c "crontab -l"
@SuperAndreyEG
Copy link

Hey! It seems that this approach is not working anymore, I am able to deploy app to beanstalk with such config but cron job is not being run. Do you know maybe how to make it work?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment