0

I'm using Mac OS Big Sur. I want to run a script every 15 minutes, so I added this using "crontab -e"

*/15 * * * /bin/bash -l -c 'sh ~/Documents/my_script.sh'

However, upon saving the changes, I get this error

$ crontab -e
crontab: installing new crontab
"/tmp/crontab.4pWPga68Wc":6: bad day-of-week
crontab: errors in crontab file, can't install

What's the right way to schedule a job to run every 15 minutes on Mac OS Big Sur?

1
  • 1
    Did you refer to the documentation on how to structure a crontab entry? Nov 13, 2022 at 18:59

1 Answer 1

0

You’re missing an asterisk

*/15 * * * *
2
  • @dave Also, if you chmod +x ~/Documents/my_script.sh you can shorten the command to /bin/bash -l ~/Documents/my_script.sh. If you don't need a login shell (which doesn't make a lot of sense for a cron job) you could also just use the script path/name.
    – nohillside
    Nov 13, 2022 at 19:52
  • That command line was an interesting mish-mash... forcing it into bash, forcing a login shell, then explicitly using sh to run it anyway. Big Sur's sh is still bash, I think. Nov 13, 2022 at 21:21

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .