o1-mini-2024-09-12· OpenAI
WildChat-4.8M (AI2)
give cron expression for every 2 hours Use format: Minute, Hour, Day of the month,…
- User
give cron expression for every 2 hours
Use format: Minute, Hour, Day of the month, Month, Day of the week. Use a space between the values. Example: 15 10 ? * MON-FRI
- Assistant
A cron expression to run a job every 2 hours using the format Minute, Hour, Day of the month, Month, Day of the week is:
code0 */2 * * *Breakdown of the Expression:
- 0 – At minute 0.
- */2 – Every 2 hours (i.e., 0, 2, 4, ..., 22).
- * – Every day of the month.
- * – Every month.
- * – Every day of the week.
Example:
If you set this cron expression, the job will trigger at:
- 00:00
- 02:00
- 04:00
- ...
- 22:00
Additional Notes:
-
Ensure that your cron scheduler interprets the expression correctly. Some systems (like Quartz) might require a different format with an extra field for seconds. In such cases, the expression would be:
code0 0 */2 * * ? -
The above expression includes: