Skip to content

Instantly share code, notes, and snippets.

@nara-l
Created September 26, 2018 15:58
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 nara-l/f40a556213084c8dbda5357ce93cbb0b to your computer and use it in GitHub Desktop.
Save nara-l/f40a556213084c8dbda5357ce93cbb0b to your computer and use it in GitHub Desktop.
Heroku Monthly Scheduler
# funny thing Heroku scheduler has no way of running a task monthly easily, one has to use a command like this:
if [ "$(date +%d)" = 01 ]; then MY_COMMAND; fi
# Run task every monday
if [ "$(date +%u)" = 1 ]; then MY_COMMAND; fi
# Run task every 24th of the year
if [ "$(date +%m)" = 12 ] && [ "$(date +%d)" = 24 ]; then MY_COMMAND; fi
# https://stackoverflow.com/a/41470302/851056
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment