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

created at 01-08-2022 views: 583

View status information:

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 Sat 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)

Jan 01 23:35:44 cc systemd[1]: Starting LSB: Jenkins Automation Server...
Jan 01 23:35:44 cc runuser[3739]: pam_unix(runuser:session): session opened for user root by (uid=0)
Jan 01 23:35:44 cc jenkins[3734]: Starting Jenkins bash: /usr/bin/java: No such file or directory
Jan 01 23:35:44 cc runuser[3739]: pam_unix(runuser:session): session closed for user root
Jan 01 23:35:44 cc jenkins[3734]: [failed]
Jan 01 23:35:44 cc systemd[1]: jenkins.service: control process exited, code=exited status=1
Jan 01 23:35:44 cc systemd[1]: Failed to start LSB: Jenkins Automation Server.
Jan 01 23:35:44 cc systemd[1]: Unit jenkins.service entered failed state.
Jan 01 23:35:44 cc systemd[1]: jenkins.service failed.

solution

1 View the current Java environment variable echo $JAVA_HOME

2 Copy the Java environment variable address, edit the /etc/init.d/jenkins file, add the address to the specified location, and append /bin/java vim /etc/init.d/jenkins with the suffix

edit

Restart the jenkins service after modification, the problem is solved systemctl start jenkins

As a result, one more warning:

[root@localhost ~]# vim /etc/init.d/jenkins
[root@localhost ~]# systemctl start jenkins
Warning: jenkins.service changed on disk. Run 'systemctl daemon-reload' to reload units.

Excuting this command:

systemctl daemon-reload

Then restart jenkins:

systemctl restart jenkins
created at:01-08-2022
edited at: 06-04-2022: