系统属性管理 [英] System properties management
问题描述
在Jenkins中是否有任何适当"的方法来更改系统属性?更改它们的最简单/最快的方法是什么?例如,我需要关闭无用的(在我的情况下)ping线程.
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.
推荐答案
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)
但这不会在重新启动后幸存下来.要使其永久,请将设置添加到java args.对于我(CentOS,Jenkins 2.7.1)而言,这是/etc/sysconfig/jenkins
一半的行(对于其他发行版,我相信它是/etc/default/jenkins
),您应该在其中将选项添加到现有列表中,如下所示:
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"
做出更改后,您必须重新启动Jenkins(感谢Mark Tickner)
You'll have to restart Jenkins after you make that change (thanks Mark Tickner)
这篇关于系统属性管理的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!