Our Jenkins instances run on Ubuntu 22.04 and were installed by apt. Does that infer the method by which Jenkins gets launched?
We want to look at changing a system property. I can see information about how to do that by passing -Dproperty=value
to the java
command line. How could we apply a custom property in our situation (where we don’t launch from the command line) ?
PS I’m told it’s handled by systemd. But still need to understand how to change property values.
That means you are using the systemd
service to manage the Jenkins service. Documentation is available with videos at
Here is the video
1 Like
@MarkEWaite Thanks for the links.
I want to modify property:
hudson.slaves.WorkspaceList
My understanding is that I should do:
$ sudo systemctl edit jenkins
and set the appropriate lines to:
# # Arguments for the Jenkins JVM
Environment="JAVA_OPTS=-Djava.awt.headless=true -Dhudson.slaves.WorkspaceList=_"
(we want an underscore as the separator).
I would then restart the service:
systemctl stop jenkins
systemctl start jenkins
I also understand that this ‘override’ would be retained when I upgrade Jenkins using apt.
Please will you confirm whether or not my understanding is correct?
Thank you!
That is correct as far as I understand it. I use that technique to set the Jenkins context path. It works for me.
@MarkEWaite When I attempt to change the Jenkins override file:
$ sudo systemctl edit jenkins
and save it, the editor suggests writing it to an odd filename, for example:
File Name to Write: /etc/systemd/system/jenkins.service.d/.#override.conf8aea33f66b6a9330
Restarting the service does not pick up the changed value.
(This is Ubuntu).
Can you tell what I am misunderstanding here please?
That is the temporary file name that is used by systemctl edit
to hold your changes. Save it as that file (without changing the name of the file) and systemctl
should apply the changes.
Thanks again for your help. It is working now.