Is there any "adequate" way to change system properties in Jenkins? What is the easiest/fastest way change them? For instance, I need to turn off the useless (in my case) pinging thread.
7 Answers
If you really want a quick and simple way to change a system property, you can use the script console
System.setProperty("hudson.remoting.Launcher.pingIntervalSec", 0)
But that won't survive a restart. To make it permanent, add the setting to the java args. For me (CentOS, Jenkins 2.7.1) that's a line about halfway down /etc/sysconfig/jenkins
(for other distributions I believe it's /etc/default/jenkins
) where you should add your option to the existing list like this:
JENKINS_JAVA_OPTIONS="-Djava.awt.headless=true -Dhudson.remoting.Launcher.pingIntervalSec=0"
You'll have to restart Jenkins after you make that change (thanks Mark Tickner)

- 2,310
- 1
- 24
- 30
-
2Updating the JENKINS_JAVA_OPTIONS worked for me, but I had to reboot the server before it took effect – Mark Tickner Aug 30 '16 at 12:35
-
2Using System.setProperty doesn't seem to work, at least not for hudson.slaves.WorkspaceList. I set it to "+" and System.getProperty verifies this but it still uses the default value "@". – Marcus Ahlberg Jan 10 '17 at 16:12
-
Ubuntu 16.04 doesn't have sysconfig folder under /etc, how to fix it ? – vikramvi Feb 13 '18 at 16:54
-
@vikramvi I believe it's /etc/default for non-RedHat distributions. Answer updated. – andrew lorien Feb 19 '18 at 01:38
-
3On Debian / Ubuntu based Linux distributions you should use `JAVA_ARGS`. – Roberto Leinardi Jun 26 '19 at 08:41
-
On Debian, see also /etc/systemd/system/jenkins.service (shown in output from /usr/sbin/service jenkins status) – Kim Taylor Mar 31 '20 at 15:48
-
1Since 2.332.1, Jenkins on Linux uses systemd to manage services. As a consequence, system properties should no longer be managed via /etc/default/jenkins or /etc/sysconfig/jenkins but via systemd unit files. See the official documentation for more details on this: https://www.jenkins.io/doc/book/system-administration/systemd-services/ – Attila Csipak Jul 08 '22 at 10:09
-
Where can i find "/etc/default/jenkins"? – Chanikya Sep 05 '22 at 06:32
If you run Jenkins on windows as a service without tomcat, you can edit jenkins.xml
. Add the property in <service><arguments>
before the -jar
.
Than restart the service.
<service>
<!-- ... -->
<arguments>-Xrs -Xmx256m -Dhudson.lifecycle=hudson.lifecycle.WindowsServiceLifecycle -Dhudson.tasks.MailSender.SEND_TO_UNKNOWN_USERS=true -Dhudson.tasks.MailSender.SEND_TO_USERS_WITHOUT_READ=true -jar "%BASE%\jenkins.war" --httpPort=8080 --webroot="%BASE%\war"</arguments>

- 2,372
- 27
- 37

- 643
- 7
- 25
The system properties available and how to set them are listed on the wiki:
https://wiki.jenkins-ci.org/display/JENKINS/Features+controlled+by+system+properties
To disable slave pinging, you can set hudson.remoting.Launcher.pingIntervalSec
to 0
.
System properties can be set in the same way as with any other Java program, e.g.:
java -Dhudson.remoting.Launcher.pingIntervalSec=0 -jar jenkins.war

- 110,418
- 27
- 198
- 193
If you use Tomcat on Windows you can edit the File C:\apache-tomcat-7.0.67\conf\catalina.properties
and simply add the Line
hudson.DNSMultiCast.disabled=true
at the End of the File. Then safe the File and restart Tomcat.

- 491
- 6
- 18
I have the similar problem: I need to disable DNSMultiCast (set hudson.DNSMultiCast.disabled = false) and I can't understand how to do it
for example, https://wiki.jenkins-ci.org/display/JENKINS/Features+controlled+by+system+properties - there is such advice "...pass all of these arguments before the -jar argument..." but I run jenkins under tomcat so I am not sure I can change startup parameters.
I tried to change /etc/tomcat6/Catalina/localhost/jenkins.xml to
<?xml version="1.0" encoding="UTF-8"?>
<Context >
<Environment name="JENKINS_HOME" value="/var/jenkins"
type="java.lang.String" override="false"/>
<Environment name="hudson.DNSMultiCast.disabled" value="true"
type="java.lang.Boolean" override="false"/>
</Context>
but I didn't help. Can someone explain how to change jenkins system properties when tomcat is used.

- 41
- 5
-
http://stackoverflow.com/questions/31719756/how-to-stop-jenkins-log-from-becoming-huge take a look at this. You may also ask the author how and where did he put this java setting and compare to your Jenkins. – Zloj Jul 30 '15 at 13:35
Maybe it's a bad hack but I set it in the pipeline job that needs the setting.
Like this:
System.setProperty("hudson.model.DirectoryBrowserSupport.CSP", "") // allow formatted HTML pages to be published
It seems to work - as far as I can tell...

- 707
- 8
- 16
I followed each steps mentioned above but it fails.
So I did change the system time zone using timedatectl set-timezone Europe/London
command and then I have restarted jenkins service service jenkins restart
it worked.
- I was using Rehdat 7.5
- Jenkins version 2.168.
- Jenkins Installed via
yum install jenkins
I hope this will help some one.

- 644
- 7
- 26