|
5 | 5 | ++++ |
6 | 6 |
|
7 | 7 |
|
8 | | -Defines a <<trigger-schedule, `schedule`>> using a <<api-cron-expressions, cron expression>> |
| 8 | +Defines a <<trigger-schedule, `schedule`>> using a <<api-cron-expressions, cron expression>> |
9 | 9 | that specifiues when to execute a watch. |
10 | 10 |
|
11 | 11 |
|
12 | | -TIP: While cron expressions are powerful, a regularly occurring schedule |
13 | | -is easier to configure with the other schedule types. |
14 | | -If you must use a cron schedule, make sure you verify it with |
15 | | -<<elasticsearch-croneval, `elasticsearch-croneval`>> . |
| 12 | +TIP: While cron expressions are powerful, a regularly occurring schedule |
| 13 | +is easier to configure with the other schedule types. |
| 14 | +If you must use a cron schedule, make sure you verify it with |
| 15 | +<<elasticsearch-croneval, `elasticsearch-croneval`>> . |
16 | 16 |
|
17 | 17 |
|
18 | 18 | ===== Configure a cron schedule with one time |
@@ -60,16 +60,40 @@ minute during the weekend: |
60 | 60 | -------------------------------------------------- |
61 | 61 | // NOTCONSOLE |
62 | 62 |
|
| 63 | +[[configue_cron_time-zone]] |
| 64 | +==== Use a different time zone for a cron schedule |
| 65 | +By default, cron expressions are evaluated in the UTC time zone. To use a different time zone, |
| 66 | +you can specify the `timezone` parameter in the schedule. For example, the following |
| 67 | +`cron` schedule triggers at 6:00 AM and 6:00 PM during weekends in the `America/Los_Angeles` time zone: |
| 68 | + |
| 69 | + |
| 70 | +[source,js] |
| 71 | +-------------------------------------------------- |
| 72 | +{ |
| 73 | + ... |
| 74 | + "trigger" : { |
| 75 | + "schedule" : { |
| 76 | + "timezone" : "America/Los_Angeles", |
| 77 | + "cron" : [ |
| 78 | + "0 6,18 * * * SAT-SUN", |
| 79 | + ] |
| 80 | + } |
| 81 | + } |
| 82 | + ... |
| 83 | +} |
| 84 | +-------------------------------------------------- |
| 85 | +// NOTCONSOLE |
| 86 | + |
63 | 87 | [[croneval]] |
64 | 88 | ===== Use croneval to validate cron expressions |
65 | 89 |
|
66 | | -{es} provides a <<elasticsearch-croneval, `elasticsearch-croneval`>> command line tool |
67 | | -in the `$ES_HOME/bin` directory that you can use to check that your cron expressions |
| 90 | +{es} provides a <<elasticsearch-croneval, `elasticsearch-croneval`>> command line tool |
| 91 | +in the `$ES_HOME/bin` directory that you can use to check that your cron expressions |
68 | 92 | are valid and produce the expected results. |
69 | 93 |
|
70 | | -To validate a cron expression, pass it in as a parameter to `elasticsearch-croneval`: |
| 94 | +To validate a cron expression, pass it in as a parameter to `elasticsearch-croneval`: |
71 | 95 |
|
72 | 96 | [source,bash] |
73 | 97 | -------------------------------------------------- |
74 | 98 | bin/elasticsearch-croneval "0 0/1 * * * ?" |
75 | | --------------------------------------------------- |
| 99 | +-------------------------------------------------- |
0 commit comments