The if-match timer cron command sets the time to perform an assistant task.
The undo if-match timer cron command cancels the time configured for performing an assistant task.
By default, the time to perform an assistant task is not specified.
if-match timer cron seconds minutes hours days-of-month months days-of-week [ years ]
undo if-match timer cron
Parameter |
Description |
Value |
---|---|---|
seconds |
Sets second. |
The value is a string of 1 to 64 characters in the cron time format. The string consists of digits 0 to 9 and special characters asterisks (*), hyphens (-), slashes (/), and commas (,). Currently, the device supports only asterisks (*), indicating that the value is accurate to the minute but not the second. |
minutes |
Sets minute. |
The value is a string of 1 to 64 characters in the cron time format. The string consists of digits 0 to 9 and special characters asterisks (*), hyphens (-), slashes (/), and commas (,). |
hours |
Sets hour. |
The value is a string of 1 to 64 characters in the cron time format. The string consists of digits 0 to 9 and special characters asterisks (*), hyphens (-), slashes (/), and commas (,). |
days-of-month |
Sets date. |
The value is a string of 1 to 64 characters in the cron time format. The string consists of digits 0 to 9 and special characters asterisks (*), hyphens (-), slashes (/), and commas (,). This parameter is exclusive with the days-of-week parameter. At least one of the two contains asterisks (*). |
months |
Sets month. |
The value is a string of 1 to 64 characters in the cron time format. The string consists of digits 0 to 9 and special characters asterisks (*), hyphens (-), slashes (/), and commas (,). |
days-of-week |
Sets week. |
The value is a string of 1 to 64 characters in the cron time format. The string consists of digits 0 to 9 and special characters asterisks (*), hyphens (-), slashes (/), and commas (,). The parameter is exclusive with the days-of-month parameter. At least one of the two contains asterisks (*). |
years |
Sets year. |
The value is a string of 1 to 64 characters in the cron time format. The string consists of digits 0 to 9 and special characters asterisks (*), hyphens (-), slashes (/), and commas (,). If this parameter is not specified, it refers to all the years between 2000 to 2099. |
Usage Scenario
The if-match timer cron command is used to set the time to perform an assistant task. The time is expressed in the cron format defined in UNIX or Linux.
Expression Mode |
Format |
Description |
Example |
---|---|---|---|
Single time point |
<time> |
<time>: The value is an integer that specifies a specific time value. The value range is dependent on a specific parameter. The range of minutes is 0 to 59. The range of hours is 0 to 23. The range of days-of-month depends on the number of days in a specific month. The range of months is 1 to 12. The range of days-of-week is 0 to 7. The range of years is 2000 to 2099. |
Command: if-match timer cron * 0 1 2 5 * 2012 Meaning: perform an assistant task at 1:00 on May 2, 2012. |
Multiple time points |
<time1>,<time2>,...,<timen> |
<timen>: The value is an integer. The value range depends on a specific parameter. Multiple time points are separated by a comma (,) with no space before or after it. The time values in a list can be arranged in any sequence. |
Command: if-match timer cron * 0 1,2,3 2 3 * 2012 Meaning: perform an assistant task at the following time points:
|
Specific time point |
<time>/<step> |
<time>: The value is an integer that specifies a specific time value. <step>: The value is an integer that specifies the time incremental. The two values are separated by a slash (/) with no space before or after it. The format: <time>,<time>+<step>,<time>+2*<step>,...,<time>+n*<step>. The maximum time (<time>+n*<step>) depends on a specific parameter in the command line. |
Command: if-match timer cron * 0 0/10 * 3 * 2012 Meaning: perform an assistant task at the following time points:
|
Duration |
<time1>-<time2> |
<time1> and <time2>: The values are integers, specifying the start and end time respectively. <time2> must be later than or equal to <time1>. The two values are separated by a hyphen (-) with no space before or after it. the <time1>-<time2> is same as <time1>,<time1>+1,<time1>+2,……,<time2>. If <time1> and <time2> are the same, they specify the same time point. |
Command: if-match timer cron *0 0-3 1 3 * 2012 Meaning: perform an assistant task at the following time points:
|
Period |
* |
If the parameter in the command line is set to *, the parameter may refer to any time point. By setting the parameter to *, you can configure the system to periodically perform an assistant task every year, week, month, day, hour, or minute. |
Command: if-match timer cron * 30 10 * 1 1 2012 Meaning: perform an assistant task at 10:30, Monday every week in January, 2012. |
Combination |
Combination format |
All the expression modes can be combined except "period". The expression modes are separated by a comma (,) with no space before or after it. |
Command: if-match timer cron * 0 0/10,2,4-5 1 3 * 2012 Meaning: perform an assistant task at the following time points:
|
Precautions
If you run the if-match timer cron command multiple times in the same view, only the latest configuration takes effect.
The days-of-month and days-of-week parameters are exclusive. Set one or both of them to "*". If one parameter is set to *, the other one specifies a specific date. If both parameters are set to *, they can refer to any date.
The minimum unit supported is minute, so set the second parameter to *. The specified assistant task works only once every minute.
Since the system can perform only one assistant task at a time, the time when one assistant task finished working may be later than the time when the next task is schedule to start. There may be a time span between the time when an assistant task is scheduled to work and the time when it actually starts to work. The if-match timer cron command specifies the time when an assistant task is scheduled to work.
When you enter digits, such as 000002012, the numeric string means the same as 2012.
# Configure an assistant task to work at 20:00, 2012-05-04.
<HUAWEI> system-view
[HUAWEI] assistant task test
[HUAWEI-assistant-task-test] if-match timer cron * 0 20 4 5 * 2012
[HUAWEI-assistant-task-test] perform 1 batch-file sys.bat
# Cancel the time for an assistant task to start to work.
<HUAWEI> system-view
[HUAWEI] assistant task test
[HUAWEI-assistant-task-test] undo if-match timer cron