Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Jenkins shows wrong time?

Tags:

jenkins

I am running Jenkins on a Linux server and shows the wrong time :(

Situation: I am running another java app (in tomcat that also runs Jenkins) that shows the correct time in the log files (I use Logback through slf4j). The bios is set to the UTC time (system clock) like advises here: http://www.linuxsa.org.au/tips/time.html

In Linux it's indicated in /etc/sysconfig/clock that the system clock is set to UTC and in which timezone we are located. I am in UTC+1

Running date command on Linux shows the correct local time. Example: Sun Jan 8 12:11:35 CET 2012 But Jenkins shows the time plus 1 hour :(...

The jenkins config shows: user.timezone = Europe/Amsterdam (which is UTC+1).

I think that Jenkins (java) thinks the local clock is set to UTC such that 1 hour is added.

How do I solve this?

like image 983
edbras Avatar asked Jan 08 '12 11:01

edbras


People also ask

How do I change the time in Jenkins?

To see the time zone currently set, go to jenkins_server/systemInfo and see the user. timezone system property. You may want to change the time zone displayed to match your own time zone. By going to your user configuration page, you can set the User Defined Time Zone to match your own.

How do I schedule a Jenkins job?

Add a Schedule to a Jenkins JobHead back to the job configuration and click the Build Triggers tab. Now, check the Build periodically box in the Build Triggers section. This will open the scheduling text area. Next, let's set the job to run every five minutes.


1 Answers

If you are running Jenkins with Docker, you can append -e JAVA_OPTS=-Duser.timezone=TZ to docker arguments.

docker run -e JAVA_OPTS=-Duser.timezone=$TZ jenkins

All available TZ can be found here.

like image 136
Quanlong Avatar answered Oct 20 '22 20:10

Quanlong