欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

启动Jenkins服务报错:Job for jenkins.service failed because the control process exited with error code

程序员文章站 2022-06-05 17:30:29
...

使用 sudo systemctl start jenkins 命令启动Jenkins服务提示如下错误:

Job for jenkins.service failed because the control process exited with error code. See "systemctl status jenkins.service" and "journalctl -xe" for details.

启动Jenkins服务报错:Job for jenkins.service failed because the control process exited with error code

按照提示使用 systemctl status jenkins.service 命令查看Jenkins服务的状态:

启动Jenkins服务报错:Job for jenkins.service failed because the control process exited with error code

注意红框处标注的位置,/usr/bin/java 是Jenkins配置文件中的默认java路径,而主机上安装的java路径不是这个,首先使用 java -version 命令查看已安装的java版本,如果版本低于1.8,需要将java版本升级到1.8或更新的版本,确认java版本符合要求后使用以下命令查看本机安装的java路径

which java

启动Jenkins服务报错:Job for jenkins.service failed because the control process exited with error code

然后修改Jenkins配置文件中的java路径

vi /etc/init.d/jenkins 

启动Jenkins服务报错:Job for jenkins.service failed because the control process exited with error code

执行 systemctl daemon-reload 命令重新加载配置文件
执行 sudo systemctl start jenkins 命令启动Jenkins
执行 systemctl status jenkins.service 命令查看Jenkins服务的状态

这时已经可以看到Jenkins服务成功启动了

启动Jenkins服务报错:Job for jenkins.service failed because the control process exited with error code