jenkins修改时区

If your Jenkins instance is running in a different location than the user’s (for example: the server is in NY but users are in LA), then the NY time zone will most probably be used, which may be quite annoying if you need to compare build dates.

To see the time zone used go to http://server/systemInfo and see the user.timezone system property.

If you cannot change the time zone of your server, then you can force jelly to use a given time zone for formatting time stamps.

So, you need to start your servlet engine with the following java system property :

java -Dorg.apache.commons.jelly.tags.fmt.timeZone=TZ …

where TZ is a java.util.TimeZone ID (“Europe/Paris” for example).

Note that

user.timezone=Europe/Paris

will work as well, but it can interfer with other contexts.

If running Jenkins via a system package, this can be accomplished by setting JAVA_ARGS in your /etc/default/jenkins (Debian)

JAVA_ARGS=”-Dorg.apache.commons.jelly.tags.fmt.timeZone=America/New_York”

or /etc/sysconfig/jenkins (Red Hat) such as:

JENKINS_JAVA_OPTIONS=”-Dorg.apache.commons.jelly.tags.fmt.timeZone=America/New_York”

or, if that doesn’t work,

JENKINS_JAVA_OPTIONS=”-Duser.timezone=America/New_York”

(note that underscores in timezone names are important) and then restarting Jenkins via the init script (not via the UI).

On FreeBSD, the file to edit is /etc/rc.conf, and the option to use is:

jenkins_java_opts=”-Dorg.apache.commons.jelly.tags.fmt.timeZone=America/Indiana/Indianapolis”

On windows, edit %INSTALL_PATH%/jenkins/jenkins.xml. Note, put “-Dargs” before “-jar”.

<>arguments>-Xrs -Xmx256m -Duser.timezone=”Europe/Minsk” -Dhudson.lifecycle=hudson.lifecycle.WindowsServiceLifecycle -jar “%BASE%\jenkins.war” –httpPort=8080

From the Jenkins Script Console on a live system without the need for a restart which can also be included in a Post-initialization script to make it permanent.

System.setProperty(‘org.apache.commons.jelly.tags.fmt.timeZone’, ‘America/New_York’)

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值