via: https://wangchujiang.com/linux-command/c/crontab.html
# ┌───────────── minute (0 - 59)
# │ ┌───────────── hour (0 - 23)
# │ │ ┌───────────── day of the month (1 - 31)
# │ │ │ ┌───────────── month (1 - 12)
# │ │ │ │ ┌───────────── day of the week (0 - 6) (Sunday to Saturday;
# │ │ │ │ │ 7 is also Sunday on some systems)
# │ │ │ │ │
# │ │ │ │ │
# * * * * * <command to execute>
crontab -l
# 显示你的作业
crontab -e
# 编辑已有的 Cron 作业
# 设定编辑器 EDITOR=nano crontab -e
- Cases
- 每 12 小时运行来自
/Users/flavio/test.sh
的脚本
* */12 * * * /Users/flavio/test.sh >/dev/null 2>&1
Reference