Creating a Schedule
この手順で新しいスケジュールを作成できます:
SYSADMIN.CreateSchedule(<
IN
biginteger jobId>, <
IN
string type>, <
IN
biginteger intervl>, <
IN
biginteger startDelay>, <
IN
string cronExpression>, <
IN
boolean enabled>, <
IN
biginteger chainedToScheduleId>, <
IN
string chainCondition>, <
IN
string chainString>, <
IN
string owner>, <
IN
string scheduleName>, <
IN
string queueHandler>, <
IN
string jobUuid>, <
IN
string uuid>, <
IN
string timezone>)
以下のパラメータを取ります:
To view the full table, click the expand button in its top right corner
Parameter | Description |
---|---|
| Id of the job the schedule belongs to (id of a ScheduleJob). |
| Can take one of four possible values; depending on the value, some other parameters are required or disregarded:
|
| How often to repeat the job in minutes. If this parameter is used, the |
| Initial delay before running the job (only before the 1st iteration, all subsequent iterations are fired in accordance with interval/cron schedule settings) |
| Provides the Quartz Cron Expression to specify the schedule. If this parameter is used, the |
| Enables the execution of the schedule according to |
| ID of the parent schedule, i.e. this schedule will be executed after the parent schedule if |
| Can take the following possible values:
If |
| Expression string when complex dependencies are used; see the section further down for a detailed explanation. If the created schedule depends only on one other schedule, either |
| The name of a schedule owner. Default: the user who runs the |
| Meant to support synchronization processes between the CData Virtuality Server instances. It is not meant to be freely editable or selectable and should not be modified without very good reason. When |
| Name of queue handler. If not set, |
| UUID of the job the schedule belongs to (UUID of a ScheduleJob) |
| Custom UUID of the schedule to be created |
| Define the timezone for the schedule ( |
owner
, jobUuid
, uuid
parameters in SYSADMIN.createSchedule
are available since v4.1
timezone
parameter in SYSADMIN.createSchedule
is available since v4.8
Examples
1. 一度だけ実行されるシンプルなスケジュールを作成します:
CALL SYSADMIN.CreateSchedule(135,
'once'
, 0, 0,
NULL
,
true
,
null
,
null
,
null
)
2. 与えられたinterval
とstartDelay
で簡単なスケジュールを作成し、すぐに実行します:
CALL SYSADMIN.CreateSchedule(1,
'interval'
, 1, 0,
null
,
true
,
null
,
null
,
null
)
3. cron式でScheduleを作成します。例えば、1回目は毎週月曜日と火曜日の午前3時から、2回目は毎日午前5時から開始します:
CALL SYSADMIN.CreateSchedule(321,
'cron'
, 1, 1,
'0 0 3 ? * MON,TUE *'
,
true
,
null
,
null
,
null
)
CALL SYSADMIN.CreateSchedule(159,
'cron'
, 1, 1,
'0 0 5 1/1 * ? *'
,
true
,
null
,
null
,
null
)
4. アメリカ/シカゴのタイムゾーンで毎日午前5:00に開始するタイムゾーンを調整したcron式でスケジュールを作成します:
CALL SYSADMIN.CreateSchedule(159,
'cron'
, 1, 1,
'0 0 5 1/1 * ? *'
,
true
,
null
,
null
,
null
,
null
,
null
,
null
,
null
,
null
,
"America/Chicago"
)
5. ID15のスケジュールが正常に終了した後に実行される、ID3のジョブの連鎖スケジュールを作成します:
CALL SYSADMIN.CreateSchedule(3,
'chained'
,
null
, 0,
null
,
true
, 15,
'SUCCESS'
,
null
)
Cron Expressions
Cron 式はQuartz Schedulerの構文を使用します。特定のスケジュールに対するExpressionsを簡単に構築するには、CronMaker siteをご確認ください。
以下のセクションは、CronTrigger tutorialおよびorg.quartz.CronExpression documentationに由来し、Apache License 2.0の著作権で保護されています。
Syntax
これらの式はCronTriggerのインスタンスを構成するために使用されます。これらは、実際にはスケジュールの個々の詳細を記述する7つのサブ式からなる文字列です。これらのサブ式は空白で区切られ、以下の要素を表します:
- Seconds
- Minutes
- Hours
- Day of month
- Month
- Day of week
- Year (optional field)
完全なcron式の例として、0 0 12 ? * WED
という文字列があります。これは「毎週水曜日12:00:00」という意味です。
個々の部分式には範囲やリストを含めることができます。例えば、先ほどの例の曜日フィールド(WED
)は、MON-FRI
、MON,WED,FRI
、MON-WED,SAT
。
すべてのフィールドには指定可能な有効値の設定があります。例えば、秒と分は0から59まで、時間は0から23までです。DAYには1から31までの任意の値を指定できますが、指定した月の日数には注意が必要です!月は 1 から 12 までの値で指定するか、文字列JAN
, FEB
, MAR
, APR
, MAY
, JUN
, JUL
, AUG
, SEP
, OCT
, NOV
, DEC
で指定できます。曜日は、1 から 7 までの値(1 = 日曜)、または文字列SUN
, MON
, TUE
, WED
, THU
, FRI
, およびSAT
で指定することができます。
Field name | Allowed values | Allowed special characters |
---|---|---|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
To view the full table, click the expand button in its top right corner
Character | Possible field(s) | Meaning |
---|---|---|
- | All | Ranges: |
, | All | Additional values: |
| All | Every possible value of this field. Thus, the |
| All | Increments to values. For example, Please note that |
| Day of month Day of week | No specific value. This is useful when you need to specify something in one of the two fields, but not the other. See the examples below (and CronTrigger JavaDoc) for clarification |
| Day of month Day of week | Short-hand for "last", but has a different meaning in each of the two fields:
Please note that when using the |
| Day of month Day of week | Weekday (Monday to Friday) closest to the given day. For example, |
# | Day of week | The Nth XXX weekday of the month. For example, |
以下に、式とその意味の例をいくつか示します。org.quartz.CronExpression のJavaDoc には、さらに多くの例が記載されています。
Examples
1. 5分ごとに起動するトリガーを作成します:
0
0
/
5
* * * ?
2. 5分ごとに、分の10秒後(午前10時00分10秒、午前10時05分10秒など)に起動するトリガーを作成します:
10
0
/
5
* * * ?
3. 毎週水曜日と金曜日の10:30、11:30、12:30、13:30に起動するトリガーを作成します:
0
30
10
-
13
? * WED,FRI
4. 毎月5日と20日の午前8時から午前10時の間、30分ごとに起動するトリガーを作成します。TRIGGERは10:00には作動せず、8:00、8:30、9:00、9:30に作動します:
0
0
/
30
8
-
9
5
,
20
* ?
例えば、"9:00から10:00の間は5分ごと、13:00から22:00の間は20分ごと "といった具合です。このシナリオでの解決策は、単純に2つのトリガーを作成し、同じジョブを実行するように両方を登録することです。
Schedules Table
To view the full table, click the expand button in its top right corner
Value | Description |
---|---|
| Unique id of the schedule itself |
| Id of the job the schedule belongs to (id of a ScheduleJob) |
| Can take one of four possible values; depending on the value, some other parameters are required or disregarded:
|
| How often to repeat the job in minutes |
| Initial delay before running the job (only before the 1st iteration, all subsequent fire in accordance with interval/cron schedule settings) |
| Quartz Cron Expression which specifies the schedule |
| Whether the schedule is active or not |
| Logical expression for the dependencies on other jobs |
| Date and time of the subsequent planned job fire (if the schedule is active, i.e. the enabled field contains |
| Name of the schedule owner |
| Unique UUID of the schedule itself |
| Time zone for the schedule ( |
cronTimezone
column in SYSADMIN.Schedules
is available since v4.8