CronTasks dùng cú pháp Cron Expression để tạo ra danh mục các sự kiện lặp lại định kỳ. Ta thường dùng Cron để lên kế hoạch bảo trì, hoặc xuất bill cho khách định kỳ.
pbs.BO.Data.CronTasks?CronExpression=*****&FromDate=...&ToDate=...&...filter..
user table(pbs.BO.Data.CronTasks?CronExpression=*****&FromDate=...&ToDate=...&...filter..)
Trong đó CronExpression có thể nhập các giá trị:
M
: split to each month.
Q
: Split to each quarter
Default ConExpression = 0 0 * * *
=> each day of months at 0:00
Default FromDate = 1, Default ToDate = LM,
pbs.BO.Data.CronTasks?CronExpression=0 0 1 * *&FromDate=20190101&ToDate=20201231
Trả về ngày 1 mỗi đầu tháng trong giai đoạn từ 2019-01-01
đến 2020-12-31
A crontab expression is a very compact way to express a recurring schedule. A single expression is composed of 5 space-delimited fields:
Produce occurrences of time based on a give schedule expressed in the crontab format:
* * * * *
- - - - -
| | | | |
| | | | +----- day of week (0 - 6) (Sunday=0)
| | | +------- month (1 - 12)
| | +--------- day of month (1 - 31)
| +----------- hour (0 - 23)
+------------- min (0 - 59)
or a six-part format that allows for seconds:
* * * * * *
- - - - - -
| | | | | |
| | | | | +--- day of week (0 - 6) (Sunday=0)
| | | | +----- month (1 - 12)
| | | +------- day of month (1 - 31)
| | +--------- hour (0 - 23)
| +----------- min (0 - 59)
+------------- sec (0 - 59)
A single wildcard (*), which covers all values for the field. So a * in days means all days of a month (which varies with month and year).
A single value, e.g. 5. Naturally, the set of values that are valid for each field varies.
A comma-delimited list of values, e.g. 1,2,3,4. The list can be unordered as in 3,4,2,6,1.
A range where the minimum and maximum are separated by a dash, e.g. 1-10. You can also specify these in the wrong order and they will be fixed. So 10-5 will be treated as 5-10.
An interval specification using a slash, e.g. */4. This means every 4th value of the field. You can also use it in a range, as in 1-6/2.
You can also mix all of the above, as in: 1-5,10,12,20-30/5
Updated on : 2020-07-29 18:30:56. by : . at T470-01.
Topic : usertables/pbs.bo.data.crontasks