Cron
Last updated
Last updated
In Hyper, cron is a system service that runs scheduled jobs at given intervals or times, just like the cron unix service but work with the containers.
The original Cron reference documentation for this implementation is found at , where Hyper Cron implementation differs:
The asterisk indicates that the cron expression matches for all values of the field. E.g., using an asterisk in the 4th field (month) indicates every month.
Slashes describe increments of ranges. For example 3-59/15 in the minute field indicate the third minute of the hour and every 15 minutes thereafter. The form */... is equivalent to the form "first-last/...", that is, an increment over the largest possible range of the field.
Commas are used to separate items of a list. For example, using MON,WED,FRI in the 5th field (day of week) means Mondays, Wednesdays and Fridays.
Hyphens define ranges. For example, 2000-2010 indicates every year between 2000 and 2010 AD, inclusive.
Create a cron job which will ping an address every 5 minutes:
Check cron job list:
Check the execution history of a cron job:
Remove a cron job:
All timestamps in Hyper Cron service is UTC+0.
When a cron job container finished, Hyper Cron service will try to get ExitCode
of the container. If the value is non-zero, the cron job is failed
.
By default, a notification email will be sent to your Hyper account's email address, when a cron job failed.
You may override to deliver the email to another address with --mailto
flag.
You may control the notification policy with --mail
flag:
on-failure
(default): send notification only when a cron job failed
on-success
: send notification only when a cron job succeeded
all
: always send notification
The notification email contains the last 100 lines of log for the cron job container.
When the Hyper Cron service is under maintaince, some cron jobs may be missed. In such case, a schedule-missed email will be sent to user.
When a cron job container finished (either succeeded or failed), the container will be cleaned up within a minute.
When you remove a cron job, it could be possible that there are cron job containers running. In such case, the container will be left running. A manual cleanup is needed.
The cron service will not retry the failed cron job.