Cron Class
(Automation::Cron)The Cron component is a time-based generator, that changes its output based on schedule configuration properties similar to crontab of Unix-like operating systems. More...
Header: | #include <Cron.h> |
Inherits: | CDPComponent |
Reimplemented Public Functions
virtual void | Create(const char *fullName) override |
virtual void | ProcessNull() override |
- 90 public functions inherited from CDPComponent
- 37 public functions inherited from CDPObject
- 46 public functions inherited from CDPBaseObject
- 26 public functions inherited from CDP::StudioAPI::CDPNode
- 22 public functions inherited from CDP::StudioAPI::ICDPNode
Protected Functions
void | CalculateNextEvent(void) |
int | MessageRestart(void *message) |
void | SetNextEventTimestampString(void) |
Reimplemented Protected Functions
virtual void | CreateModel() override |
- 12 protected functions inherited from CDPComponent
- 13 protected functions inherited from CDPObject
- 1 protected function inherited from CDP::StudioAPI::CDPNode
Additional Inherited Members
- 90 public functions inherited from CDPComponent
- 37 public functions inherited from CDPObject
- 46 public functions inherited from CDPBaseObject
- 26 public functions inherited from CDP::StudioAPI::CDPNode
- 22 public functions inherited from CDP::StudioAPI::ICDPNode
- 2 static public members inherited from CDPComponent
- 6 static public members inherited from CDPObject
- 1 static public member inherited from CDPBaseObject
- 42 protected variables inherited from CDPComponent
- 9 protected variables inherited from CDPObject
- 11 protected variables inherited from CDPBaseObject
Detailed Description
The Cron component is a time-based generator, that changes its output based on schedule configuration properties similar to crontab of Unix-like operating systems.
Schedule Configuration Properties
Property | Description |
---|---|
Sec | Scheduled second (0-59) |
Min | Scheduled minute (0-59) |
Hour | Scheduled hour (0-23) |
Day | Scheduled day of the month (1-31) |
Mon | Scheduled month (1-12) |
DoW | Scheduled day of the week (1 or MON - Monday, 6 or SAT - Saturday, 0 or 7 or SUN - Sunday) |
In addition to simple value every schedule configuration property can be also have a special form
Special form | Meaning scheduled at |
---|---|
* | Every value |
*/N (eg. */5) | Every N-th value (eg. 0,5,15 etc) |
? | Despite of the value (can be used in Day when specifying DoW or vice versa) |
Comma separated list of digits | All listed values |
Dash separated range (eg. 1-4) | All values in the range (eg. 1, 2, 3 and 4) |
Signals
Signal | Description |
---|---|
Output | Scheduled output (changes its value at every event) |
NextTimestamp | Timestamp of the next scheduled output change (in format "DOW MON DD HH:MM:SS YYYY") |
SecondsLeft | Time left to the next scheduled output change (in seconds) |
Messages
Message | Description |
---|---|
CM_SUSPEND | Suspend the scheduler. |
CM_ACTIVATE | Resume the scheduler. |
Restart | Re-schedule (ie. re-calculate the next event timestamp). |
Note: Note that you have to send Restart message after changing schedule configuration properties if you need to take them into effect immediately (before already calculated next event is reached).
Cron Schedule Configuration Examples
Sec | Min | Hour | Day | Mon | Dow | Schedule |
---|---|---|---|---|---|---|
* | * | * | * | * | * | After every second |
*/15 | * | 1-4 | * | * | * | Every night during 01:00:00 - 04:59:45, after every 15 seconds |
0 | */2 | 2,4 | * | * | * | Every night between 02:00:00 - 02:58:00 and 04:00:00 - 04:58:00, after every 2 minutes |
0 | 0 | 7 | ? | * | MON-FRI | Every weekday (eg. from Monday to Friday) at 07:00:00 |
0 | 30 | 23 | 30 | */3 | ? | Every third month on day 30 at 23:30:00 |
0 | 0 | 1 | ? | 1 | MON | Once a year at first Monday in January at 01:00:00 |
Member Function Documentation
[protected]
void Cron::CalculateNextEvent(void)
[override virtual]
void Cron::Create(const char *fullName)
[override virtual protected]
void Cron::CreateModel()
[protected]
int Cron::MessageRestart(void *message)
[override virtual]
void Cron::ProcessNull()
[protected]
void Cron::SetNextEventTimestampString(void)
Get started with CDP Studio today
Let us help you take your great ideas and turn them into the products your customer will love.