cronjob TumCronJob component
Properties Events
Previous  Top  Next
Overview
The CronJob component is the thread-based alarm timer implementation for Delphi and C++ Builder which acts like cronjob utility in Unix. The component produces periodical OnAlert events by schedule specified in CRON format (actually it uses extended CRON format with new "seconds" field, to let the event to be triggered even every second).  

CRON format
To specify the moments when the component should trigger the OnAlert event, the component uses the CRON format (all who worked in Unix must be aware about this utility, this is daemon of scheduled, periodically executed tasks). The authors of CronJob component has very liked an idea of describing the periodical events of any complexity, tiered to astronomical time, in simple text string. We have used slightly modified CRON format, added seconds field and altered the rules of describing the lists of numbers.  
 
The CronMask property presents itself of several "list of numbers", separated by space. Every list specifies enumeration of moments of time or date, in units, dependant of position of the list in the mask string.  
 
The CronMask schedule should be specified in following maneer (list of numbers/enumerations separated by spaces):  
Seconds Minutes Hours Days Months DaysOfWeek  
 
Here is some examples of describing of schedule in the CRON format:  
·Each minute at 0 seconds and 30 seconds:   0,30  
   0+30  
   +30  
·Each second at 0, 8 and 16 hours:   0-59 0-59 0-16+8  
   * * 0+8  
   * * +8  
·The beginning of each hour, except noon and midnight:   0 0 1-11,13-23  
·Every 3 seconds of 1st day of each month:   0-59+3 * * 1  
   +3 * * 1  
·30 minutes, 0 seconds of each hour at Sunday:   0 30 * * * 0  
 
Description of CRON lists
The string list with numbers without spaces is the group of numbers separated by comma "," (i.e: 0,30). The group can contain one number or the range of numbers. The ranges should be specified by two numbers, separated by hyphen "-" (the beginning and ending of the range, i.e: 0-9). Optionally, after the range you can also specify the value of step, separated by plus "+" (i.e: 0-59+5). The default step value (if none specified) is 1. If the step specified, the ending value may be not specified, by default it will be the maximal value in context of purpose of the list. The beginning of the range is 0 by default (or 1 for days and monthes).  
 
The asterisk sign "*" instead of group means all diapasone of possible values in the context.  
 
The order of values or ranges in one list is not important. For example, the list like 0-5,12,8,20-30+2 is interpreted as following enumeration: 0,1,2,3,4,5,8,12,20,22,24,26,28,30.  

How to use
Drop the CronJob component on your form, specify the CronMask property and write the OnAlert event handler which will process scheduled events.  

See also
umAccurateTimer and umAwayTimer components.  
File not found.