Jenkins 没有在 Ubuntu 中获取已更改的配置文件 (/etc/default/jenkins)
使用:
- Ubuntu 20.04.2 LTS
- Java 1.8.0_322
- Jenkins 2.332.1
我一直在尝试更改 /etc/default/jenkins 文件中的 HTTP 端口或用户。然而,一旦我这样做了,这些变化就不会被接受:
sudo service jenkins restart
这里的答案似乎也不起作用: Jenkins 在 /etc/default/jenkins 中的更改不起作用
sudo systemctl edit jenkins
打开一个新文件进行编辑
Using:
- Ubuntu 20.04.2 LTS
- Java 1.8.0_322
- Jenkins 2.332.1
I've been attempting to change the HTTP port or the User in /etc/default/jenkins file. However the changes are not picked up once I do:
sudo service jenkins restart
The answer here also doesn't seem to work:
Jenkins changes in /etc/default/jenkins not working
sudo systemctl edit jenkins
just opens a new file for editing
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
编辑
/etc/default/jenkins
在Jenkins版本2.332.1之后不起作用,该版本依赖于
在SystemD而不是Init System上(文档)。
相反,运行:
将带有一个空文件的编辑器。创建下面的部分:
根据需要更改端口并保存文件(如果Nano为编辑器,则使用
ctrl + X,Y
)。最后,重新启动詹金斯,它应该接收新端口:
Editing
/etc/default/jenkins
does not work after Jenkins version 2.332.1, which relies
on systemd rather than the init system (documentation).
Instead, run:
which will bring up an editor with an empty file. Create the section below with the following:
Change the port as desired and save the file (in case of nano as editor with
Ctrl + X, Y
).Finally, restart Jenkins and it should pick up the new port:
使用 Debian Bullseye (Debian 11) :
vim /etc/systemd/system/jenkins.service.d/override.conf
关键是编辑配置文件来覆盖默认配置,因为默认配置每个新版本都会更新配置,从而删除您的自定义配置。
不要忘记使用以下命令更新并重新加载更改:
systemctl daemon-reload
service jenkins restart
With Debian Bullseye (Debian 11) :
vim /etc/systemd/system/jenkins.service.d/override.conf
The key is to edit the config file which is overriding the default configuration, because the default configuration is updated each new release, erasing your custom config.
Don't forget to update and reload your changes with :
systemctl daemon-reload
service jenkins restart
实际上是有效的,就像问题的链接中一样。它不会修改配置文件,但是在这里添加的任何内容覆盖可以使用以下方式查看的配置:
Is what actually works,, as in the link in the question. It doesn't modify the config file, but anything that gets added here overwrites the config that can be viewed using: