mirror of
https://github.com/elastic/elasticsearch.git
synced 2025-06-30 02:13:33 -04:00
* Add timezone support to Cron objects * Add timezone support to CronnableSchedule * XContent change to support parsing and display of TimeZone fields on schedules * Case insensitive timezone parsing * Doc changes * YAML REST tests * Equals, toString and HashCode now include timezone * Additional random testing for DST transitions * Migrate Cron class to use wrapped LocalDateTime The algorithm depends on some quirks of calendar but LocalDateTime correctly ignores DST during calculations so this uses a LocalDateTime with a wrapper to emulate some of Calendar's behaviours that the Cron algorithm depends on * Additional documentation to explain discontinuity event behaviour * Remove redundant conversions from ZoneId to TimeZone following move to LocalDateTime * Add documentation warning that manual clock changes will cause unpredictable watch execution * Update docs/reference/watcher/trigger/schedule.asciidoc Co-authored-by: Lee Hinman <dakrone@users.noreply.github.com> --------- Co-authored-by: Lee Hinman <dakrone@users.noreply.github.com>
104 lines
3.1 KiB
Text
104 lines
3.1 KiB
Text
[role="xpack"]
|
|
[[schedule-weekly]]
|
|
==== {watcher} weekly schedule
|
|
++++
|
|
<titleabbrev>Weekly schedule</titleabbrev>
|
|
++++
|
|
|
|
A <<trigger-schedule,`schedule`>> that triggers at a specific day and time
|
|
every week. To use the `weekly` schedule, you specify the day and time (or days
|
|
and times) when you want the scheduler to start the watch execution with the `on`
|
|
and `at` attributes.
|
|
|
|
You can specify the day of the week by name, abbreviation, or number (with Sunday
|
|
being the first day of the week):
|
|
|
|
* `sunday`, `monday`, `tuesday`, `wednesday`, `thursday`, `friday` and `saturday`
|
|
* `sun`, `mon`, `tue`, `wed`, `thu`, `fri` and `sat`
|
|
* `1`, `2`, `3`, `4`, `5`, `6` and `7`
|
|
|
|
Times are specified in the form `HH:mm` on a 24-hour clock. You can also use the
|
|
reserved values `midnight` and `noon` for `00:00` and `12:00`.
|
|
|
|
===== Configuring a weekly schedule
|
|
|
|
To configure a once a week schedule, you specify the day with the `on` attribute
|
|
and the time with the `at` attribute. For example, the following `weekly` schedule
|
|
triggers once a week on Friday at 5:00 PM:
|
|
|
|
[source,js]
|
|
--------------------------------------------------
|
|
{
|
|
"trigger" : {
|
|
"schedule" : {
|
|
"weekly" : { "on" : "friday", "at" : "17:00" }
|
|
}
|
|
}
|
|
}
|
|
--------------------------------------------------
|
|
// NOTCONSOLE
|
|
|
|
NOTE: You can also specify the day and time with the `day` and `time` attributes,
|
|
they are interchangeable with `on` and `at`.
|
|
|
|
===== Configuring a multiple times weekly schedule
|
|
|
|
To configure a `weekly` schedule that triggers multiple times a week, you can
|
|
specify an array of day and time values. For example, the following `weekly`
|
|
schedule triggers every Tuesday at 12:00 PM and every Friday at 5:00 PM:
|
|
|
|
[source,js]
|
|
--------------------------------------------------
|
|
{
|
|
"trigger" : {
|
|
"schedule" : {
|
|
"weekly" : [
|
|
{ "on" : "tuesday", "at" : "noon" },
|
|
{ "on" : "friday", "at" : "17:00" }
|
|
]
|
|
}
|
|
}
|
|
}
|
|
--------------------------------------------------
|
|
// NOTCONSOLE
|
|
|
|
Alternatively, you can specify days and times in an object that has `on` and
|
|
`minute` attributes that contain an array of values. For example, the following
|
|
`weekly` schedule triggers every Tuesday and Friday at 12:00 PM and 17:00 PM:
|
|
|
|
[source,js]
|
|
--------------------------------------------------
|
|
{
|
|
"trigger" : {
|
|
"schedule" : {
|
|
"weekly" : {
|
|
"on" : [ "tuesday", "friday" ],
|
|
"at" : [ "noon", "17:00" ]
|
|
}
|
|
}
|
|
}
|
|
}
|
|
--------------------------------------------------
|
|
// NOTCONSOLE
|
|
|
|
==== Use a different time zone for a weekly schedule
|
|
By default, weekly schedules are evaluated in the UTC time zone. To use a different time zone,
|
|
you can specify the `timezone` parameter in the schedule. For example, the following
|
|
`weekly` schedule triggers at 6:00 AM and 6:00 PM on Tuesdays and Fridays in the
|
|
`America/Buenos_Aires` time zone:
|
|
|
|
[source,js]
|
|
--------------------------------------------------
|
|
{
|
|
"trigger" : {
|
|
"schedule" : {
|
|
"timezone" : "America/Buenos_Aires",
|
|
"weekly" : {
|
|
"on" : [ "tuesday", "friday" ],
|
|
"at" : [ "6:00", "18:00" ]
|
|
}
|
|
}
|
|
}
|
|
}
|
|
--------------------------------------------------
|
|
// NOTCONSOLE
|