CRONTAB
Create or modify a scheduled event.
WebVue support - Yes.
Mode |
Mnemonic |
Syntax |
1 | ADDPROG | 1 |
2 | DELPROG | 1 |
3 | ADDVAR | 2 |
4 | DELVAR | 2 |
6 | DELALL | 3 |
7 | TABLE_STATUS | 4 |
8 | TABLE_ELAPSED | 4 |
9 | TABLE_REMAINING | 4 |
11 | NETWORKBROADCAST | 5 |
12 | SAVE | 3 |
13 | TRACE | 6 |
15 | ADDPROG_EX | 1 |
16 | DELPROG_EX | 1 |
17 | EXECUTE_TABLE | 7 |
18 | EXECUTE_ALLTABLES | 3 |
Syntax 1
IntVal = CRONTAB(Mode, CRONTYPE, Date, Time, Program, Branch, Function [, Farg [, ActivBit] ]);
Return type: INTEGER.
Argument |
Meaning |
CRONTYPE |
The agenda type of the event: |
1 |
ONCE |
2 |
EACH_HOUR |
3 |
EACH_DAY |
4 |
EACH_WEEK |
5 |
EACH_MONTH |
Date |
A string representing either the date or the day according to the type of event as specified by CRONTYPE. |
|
A date is specified in either dd/mm/yy or dd/mm/yyyy format, for example 05/08/2003. |
|
If specifying a day, the name of the day is given. |
|
"monday" or "mon" |
|
"tuesday" or "tue" |
|
"wednesday" or "wed" |
|
"thursday" or "thu" |
|
"saturday" or "sat" |
|
"sunday" or "sun" |
Time |
Represents the time (hh:mm) or the minute (mm) according to the type of event CRONTYPE. "17:38" or "38". Type STR. |
Program |
The name of the program that contains the function to be executed. Type STR. |
Branch |
The branch for the program. Type STR. |
Function |
The name of the function to be executed. Type STR. |
Farg |
Optional. A string of 2,047 characters maximum used to provide up to 8 arguments (separated by a comma) to the function. The arguments are retrieved in the function using the verb GETARG. |
ActivBit |
Optional. The name of the bit or alarm variable which enables the event. |
Execution
Mode |
Mnemonic |
Action |
1 |
ADDPROG |
Create an event, or modify it if it exists, to run a program. |
|
|
The created event is temporary. It is not possible to modify a permanent event created from CONFIGURE.Actions.Scheduler. |
2 |
DELPROG |
Delete an event, which runs a program. |
|
|
It is not possible to delete a permanent event. |
15 | ADDPROG_EX | Create an event to run a program. |
Similar mode 1, except that the fields Farg and ActivBit can be used to distinguish between events that are otherwise identical. | ||
16 | DELPROG_EX | Delete an event, which runs a program. |
Similar mode 2, except that the fields Farg and ActivBit can be used to distinguish between events that are otherwise identical. | ||
Return: 1 if successful, else 0. |
The program must be pre-loaded. A cyclic function may not be changed once it is running. It must be stopped and re-programmed.
The use of DELAY within a function that is called cyclically may produce unpredictable results and should be avoided.
The format of the date when using the mode ONCE can be either dd/mm/yy or dd/mm/yyyy.
Syntax 2
IntVal =CRONTAB(Mode, TYPE, Date, Time, Variable, Send_Mode, Delay [, "", ActivBit] );
Return type: INTEGER.
Argument |
Meaning |
TYPE |
The agenda type for the event: |
|
ONCE 1 |
|
EACH_HOUR 2 |
|
EACH_DAY 3 |
|
EACH_WEEK 4 |
|
EACH_MONTH 5 |
Date |
A string representing either the date or the day according to the type of event as specified by TYPE. |
|
A date is specified in either dd/mm/yy or dd/mm/yyyy format, for example 05/08/2003. |
|
If specifying a day, the name of the day is given. |
|
"monday" or "mon" |
|
"tuesday" or "tue" |
|
"wednesday" or "wed" |
|
"thursday" or "thu" |
|
"saturday" or "sat" |
|
"sunday" or "sun" |
Time |
Represents the time (hh:mm) or the minute (mm) according to event TYPE. "17:38" or "38". Type STR. |
Variable |
The full name of the variable to be forced (Bit or alarm only). |
S_Mode |
0: set to 0. |
|
1: set to 1. |
|
2: reverse state. |
Delay |
If not 0, the variable is forced as a pulse. The duration is specified in seconds. |
"" | Unused parameter. Must be included if using the optional ActivBit parameter. Type STR. |
ActivBit |
Optional. The name of the bit or alarm variable which enables the event. |
Execution
Mode |
Mnemonic |
Action |
3 |
ADDVAR |
Create (or modify if existing) an event which forces a variable. The created event is temporary. It is not possible to modify a permanent event. |
4 |
DELVAR |
Delete an event that forces a variable. It is not possible to delete a permanent event. |
|
|
Return: 1 if the successful, else 0. |
Syntax 3
IntVal = CRONTAB(Mode);
Return type: INTEGER.
Execution
Mode |
Mnemonic |
Action |
6 |
DELALL |
Delete all the temporary events. |
|
|
Return: Always 1. |
12 |
SAVE |
Forces a save of the Scheduler configuration in the file CRON.DAT. |
|
|
Return: Always 0. |
18 | EXECUTE_ALLTABLES |
Execute all timetables. The actions are executed immediately irrespective of the timetable configuration. Return: Always 0. |
Syntax 4
LongVal = CRONTAB(Mode, TableName);
Return type: LONG.
Argument |
Meaning |
TableName |
The name of a timetable as created from Scheduler option of the ACTIONS sub-menu. Type STR. |
Execution
Mode |
Mnemonic |
Action |
7 | TABLE_STATUS |
Tests whether any of time interval is currently active for the timetable TableName. Return: 1 (a time interval is active), 0 (no active time interval), -1 if the timetable does not exist. |
8 | TABLE_ELAPSED |
Returns the number of seconds since the previous timetable transition. A transition is either the start or end of a time interval. Return: -1 if the timetable does not exist or the calculation is impossible (no time interval defined). |
9 | TABLE_REMAINING |
Returns the number of seconds until the next timetable transition. A transition is either the start or end of a time interval. Return: -1 if the timetable does not exist or the calculation is impossible (no time interval defined). |
Syntax 5
IntVal =CRONTAB(Mode, List, HStatus, EventVar, LocalRemote);
Return type: INTEGER.
Argument |
Meaning |
List |
The name of the list containing the names of the network stations to receive modifications (as created from the command Configure.Communication.Network Stations). Type STR. The list must be of type Modification client list. |
HStatus |
The handle of a buffer allocated by ALLOC_BUFFER. After the instruction has been executed the buffer will contain a list of stations and their update status in the format: StaNum,Status,...; where StaNum is the number of the station and Status is 1 if successful, else 0. Type LONG. |
EventVar |
The name of a bit variable that will be set to 1 when the instruction has been executed. Type STR. |
LocalRemote |
To determine where the changed Scheduler configuration file CRON.DAT is applied: 1: All stations (including the local station). 0: Remote stations only. (Default) |
Execution
Mode |
Mnemonic |
Action |
11 |
NETWORKBROADCAST |
Sends the Scheduler configuration file CRON.DAT to all stations in the modification clients list. |
|
|
Return: 1 successful, else 0. |
Syntax 6
IntVal =CRONTAB(Mode, SubMode);
Return type: INTEGER.
Argument |
Meaning |
SubMode |
Either "ON" or "OFF". Type STR. |
Execution
Mode |
Mnemonic |
Action |
13 | TRACE |
Activate ("ON") or deactivate ("OFF") diagnostic messages. Trace messages appear in the Event window (F7). |
Syntax 7
IntVal = CRONTAB(Mode, TableName);
Return type: INTEGER.
Argument |
Meaning |
TableName |
The name of a timetable as created from Scheduler option of the ACTIONS sub-menu. Type STR. |
Execution
Mode |
Mnemonic |
Action |
17 | EXECUTE_TABLE |
Execute the specified timetable. The action is executed immediately irrespective of the timetable configuration. Return: 0 if successful, else 1. |
Trace message example
[SV.Scheduler] The traces are activated
[SV.UI.Scheduler]<Each hour at minute [30]> Adding or Modifying Agenda Frequency Function to execute: Program [test_crontab.svb], Branch [], Function [Hello], Arguments []
[SV.UI.Scheduler] Deleting Agenda Frequency [Each hour at minute [30]] Function to execute: Program [test_crontab.svb], Branch [], Function [Hello], Arguments []
Example
For an example, select the Example link above.