Skip to content
Permalink
Browse files

Merge pull request #2927 from daniel-beck/JENKINS-9283-docs

Document timezone specification and provide full list

(cherry picked from commit 26fc2a9)
  • Loading branch information...
oleg-nenashev authored and olivergondza committed Jul 1, 2017
1 parent 4ee8195 commit beb63a2f5944ea63f128dfe0500b3b431c4b72f8
@@ -108,9 +108,9 @@ public static CronTabList create(@Nonnull String format, Hash hash) throws ANTLR
if(lineNumber == 1 && line.startsWith("TZ=")) {
timezone = getValidTimezone(line.replace("TZ=",""));
if(timezone != null) {
LOGGER.log(Level.CONFIG, "cron with timezone {0}", timezone);
LOGGER.log(Level.CONFIG, "CRON with timezone {0}", timezone);
} else {
LOGGER.log(Level.CONFIG, "invalid timezone {0}", line);
throw new ANTLRException("Invalid or unsupported timezone '" + timezone + "'");
}
continue;
}
@@ -1,3 +1,5 @@
<?jelly escape-by-default='true'?>
<j:jelly xmlns:j="jelly:core" xmlns:l="/lib/layout">
<div>
This field follows the syntax of cron (with minor differences).
Specifically, each line consists of 5 fields separated by TAB or whitespace:
@@ -80,4 +82,33 @@
# once a day on the 1st and 15th of every month except December
H H 1,15 1-11 *
</pre>
<h3>Time zone specification</h3>
<j:invokeStatic className="java.util.TimeZone" method="getDefault" var="currentTimeZone"/>
<p>
Periodic tasks are normally executed at the scheduled time in the time zone of
the Jenkins master JVM (currently <strong>${currentTimeZone.getID()}</strong>).
This behavior can optionally be changed by specifying an alternative time zone in the
first line of the field.
Time zone specification starts with <code>TZ=</code>, followed by the ID of a time zone.
</p>
<p>
Complete example of a schedule with a time zone specification:
</p>
<pre>
TZ=Europe/London
# This job needs to be run in the morning, London time
H 8 * * *
# Butlers do not have a five o'clock, so we run the job again
H(0-30) 17 * * *
</pre>
<p>
The supported time zones depend on the Java runtime Jenkins is running on. The list of supported time zone IDs on this instance is:
</p>
<j:invokeStatic className="java.util.TimeZone" method="getAvailableIDs" var="timeZones"/>
<ul>
<j:forEach items="${timeZones}" var="timeZone">
<li>${timeZone}</li>
</j:forEach>
</ul>
</div>
</j:jelly>

0 comments on commit beb63a2

Please sign in to comment.
You can’t perform that action at this time.