查看狀態信息:
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