Jenkins++:Job for jenkins.service failed because the control process exited with error code. See "systemctl st

查看状态信息:

systemctl status jenkins.service
[root@cc sysconfig]# systemctl start jenkins
Job for jenkins.service failed because the control process exited with error code. See "systemctl status jenkins.service" and "journalctl -xe" for details.
[root@cc sysconfig]# systemctl status jenkins.service
● jenkins.service - LSB: Jenkins Automation Server
   Loaded: loaded (/etc/rc.d/init.d/jenkins; bad; vendor preset: disabled)
   Active: failed (Result: exit-code) since 六 2022-01-01 23:35:44 CST; 2min 4s ago
     Docs: man:systemd-sysv-generator(8)
  Process: 3734 ExecStart=/etc/rc.d/init.d/jenkins start (code=exited, status=1/FAILURE)

1月 01 23:35:44 cc systemd[1]: Starting LSB: Jenkins Automation Server...
1月 01 23:35:44 cc runuser[3739]: pam_unix(runuser:session): session opened for user root by (uid=0)
1月 01 23:35:44 cc jenkins[3734]: Starting Jenkins bash: /usr/bin/java: 没有那个文件或目录
1月 01 23:35:44 cc runuser[3739]: pam_unix(runuser:session): session closed for user root
1月 01 23:35:44 cc jenkins[3734]: [失败]
1月 01 23:35:44 cc systemd[1]: jenkins.service: control process exited, code=exited status=1
1月 01 23:35:44 cc systemd[1]: Failed to start LSB: Jenkins Automation Server.
1月 01 23:35:44 cc systemd[1]: Unit jenkins.service entered failed state.
1月 01 23:35:44 cc systemd[1]: jenkins.service failed.

解决方案:
1> 查看当前Java的环境变量 echo $JAVA_HOME

2> 复制Java的环境变量地址, 编辑/etc/init.d/jenkins文件, 指定位置添加该地址, 后缀附上/bin/java vim /etc/init.d/jenkins

修改后重启 jenkins 服务, 问题解决 systemctl start jenkins

结果,又有一个警告 :

执行命令:

systemctl daemon-reload

然后重启 jenkins:

systemctl restart jenkins
原文地址:https://www.cnblogs.com/codingmode/p/15756519.html