How to schedule a cron job at midnight and midday?
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 | 6296 | cron command every day at midnight | https://en.ans.wiki/460/how-to-schedule-a-cron-job-at-midnight-and-midday | 1 |
1 | 3889 | cron every day at 12 am | https://en.ans.wiki/460/how-to-schedule-a-cron-job-at-midnight-and-midday | 1 |