Execution of Action Codes on a schedule. Constantly or once.
Also, see the PRO Daemons functionality if you need to create constantly running workers.
Located in System Tables
— Main
— Settings and cron
— Crons
:
Codes from the cron table are launched by the utility bin/totum schemas-crons
, which checks every minute for rows that meet the launch condition.
Only codes with the enabled
parameter turned on are launched.
The time-based launch condition works as follows:
If the field is filled, the code will be executed at the specified time.
If the field is not filled, the code will be executed at all available intervals in that field.
If all fields are empty, the code will be launched every minute.
Be careful with codes regarding their execution time. By default, a cron launched in the subsequent interval does not check the completion of the previous one.
If you enable ttm__overlay_control
, non-transactional global variables will be used to determine the operation of the previously launched cron of the same row.
When Totum launches a cron, it will check the value of the technical variable by cron id, and if it is not recorded that the previous cron is in operation, the current instance of the cron will be launched, and the variable will be recorded.
When the cron finishes its execution, it removes the flag in the variable.
The code provides that the cron may end with an error within the script timeout. In this case, the variable indicating its execution will be removed. But if the cron exceeds the timeout (default is 120 seconds), the variable will remain set to true
.
Therefore, it is also necessary to set the ttm__overlay_timeout
parameter in minutes, which means that if the variable is set to true
but more than this interval has passed, it indicates an error, and the cron for the current interval can be launched.