Skip to content

Instantly share code, notes, and snippets.

@manojahi
Created January 16, 2022 07:48
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 manojahi/a16812b247057d51f5bcb0baeeac2cca to your computer and use it in GitHub Desktop.
Save manojahi/a16812b247057d51f5bcb0baeeac2cca to your computer and use it in GitHub Desktop.
Cronjob in elastic beanstalk
files:
/usr/local/bin/my_cron_script.sh:
mode: "000755"
owner: root
group: root
content: |
#!/bin/bash
export $(cat /opt/elasticbeanstalk/deployment/env | xargs)
source $PYTHONPATH/activate
python3 /var/app/current/manage.py my_process
/etc/cron.d/my_cron:
mode: "000644"
owner: root
group: root
content: |
0 * * * * root /usr/local/bin/my_cron_script.sh >> /var/log/my_cron.log 2>&1
commands:
rm_old_cron:
command: "rm -fr /etc/cron.d/*.bak"
ignoreErrors: true
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment