Job for jenkins.service failed because the control process exited with error code.

[email protected]:~# service jenkins restart
Job for jenkins.service failed because the control process exited with error code.
See "systemctl status jenkins.service" and "journalctl -xe" for details.

 

[email protected]:~# systemctl status jenkins.service
● jenkins.service - LSB: Start Jenkins at boot time
Loaded: loaded (/etc/init.d/jenkins; generated; vendor preset: enabled)
Active: failed (Result: exit-code) since Tue 2019-09-17 16:52:59 CST; 1min 32s ago
Docs: man:systemd-sysv-generator(8)
Process: 28888 ExecStart=/etc/init.d/jenkins start (code=exited, status=1/FAILURE)

9月 17 16:52:59 xiakaibi-PC systemd[1]: Starting LSB: Start Jenkins at boot time...
9月 17 16:52:59 xiakaibi-PC jenkins[28888]: ERROR: No Java executable found in current PATH: /bin:/usr/bin:/sbin:/usr/sbi
9月 17 16:52:59 xiakaibi-PC jenkins[28888]: If you actually have java installed on the system make sure the executable is
9月 17 16:52:59 xiakaibi-PC systemd[1]: jenkins.service: Control process exited, code=exited status=1
9月 17 16:52:59 xiakaibi-PC systemd[1]: Failed to start LSB: Start Jenkins at boot time.
9月 17 16:52:59 xiakaibi-PC systemd[1]: jenkins.service: Unit entered failed state.
9月 17 16:52:59 xiakaibi-PC systemd[1]: jenkins.service: Failed with result 'exit-code'.

 

解决办法 
意思就是没有找到java文件,需要自己把java文件地址复制过去 

打开etc/init.d/jenkins文件,可以看到头部指定的path路径没有包含java_home。应该是在第一次安装的时候,系统读取了jdk未安装时的路径。修改配置再试下

 

Job for jenkins.service failed because the control process exited with error code.

 

重启jenkins:

sudo service jenkins restart