How to schedule a cron job at midnight and midday (twice a day)?
To schedule a cron job twice a day, use the following syntax (it will run the task at midnight and midday):
0 0,12 * * * user-name /path/to/command
# | | | | |
# | | | | .---- Every day of the week
# | | | .------- Every month
# | | .---------- Every day
# | .-------------- When hours equal zero or twelve (, = list separator)
# .------------------ When minutes equal 0
To schedule a cron job twice a day, use the following syntax (it will run the task at midnight and midday):
0 0,12 * * * user-name /path/to/command
# | | | | |
# | | | | .---- Every day of the week
# | | | .------- Every month
# | | .---------- Every day
# | .-------------- When hours equal zero or twelve (, = list separator)
# .------------------ When minutes equal 0
To schedule a cron job twice a day, use the following syntax (it will run the task at midnight and midday) :
0 0,12 * * * user-name /path/to/command
# | | | | |
# | | | | .---- Every day of the week
# | | | .------- Every month
# | | .---------- Every day
# | .-------------- When hours equal zero or twelve (, = list separator)
# .------------------ When minutes equal 0
| # | ID | Query | URL | Count |
|---|---|---|---|---|
| 0 | 13121 | en | https://en.ans.wiki/461/how-to-schedule-a-cron-job-at-midnight-and-midday-twice-a-day | 5 |