rpm安装jenkins后启动报错Starting Jenkins bash: /usr/local/java: 是一个目录

报错如下:

[root@localhost /]# 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-02-21 15:27:10 CST; 7s ago
Docs: man:systemd-sysv-generator(8)
Process: 14141 ExecStart=/etc/rc.d/init.d/jenkins start (code=exited, status=1/FAILURE)

2月 21 15:27:10 localhost.localdomain systemd[1]: Starting LSB: Jenkins Automation Server…
2月 21 15:27:10 localhost.localdomain runuser[14146]: pam_unix(runuser:session): session opened for user jenkins by (uid=0)
2月 21 15:27:10 localhost.localdomain jenkins[14141]: Starting Jenkins bash: /usr/bin/java: 是一个目录
2月 21 15:27:10 localhost.localdomain jenkins[14141]: [失败]
2月 21 15:27:10 localhost.localdomain systemd[1]: jenkins.service: control process exited, code=exited status=1
2月 21 15:27:10 localhost.localdomain systemd[1]: Failed to start LSB: Jenkins Automation Server.
2月 21 15:27:10 localhost.localdomain systemd[1]: Unit jenkins.service entered failed state.
2月 21 15:27:10 localhost.localdomain systemd[1]: jenkins.service failed.
[root@localhost /]# vim /etc/rc.d/init.d/jenkins

这一看报错,明显java环境出了问题,找不到java了

检查java环境:

[root@localhost /]# systemctl daemon-reload
[root@localhost /]# systemctl restart jenkins
[root@localhost /]# systemctl status jenkins
● jenkins.service - LSB: Jenkins Automation Server
Loaded: loaded (/etc/rc.d/init.d/jenkins; bad; vendor preset: disabled)
Active: active (running) since 一 2022-02-21 15:30:38 CST; 6s ago
Docs: man:systemd-sysv-generator(8)
Process: 15485 ExecStop=/etc/rc.d/init.d/jenkins stop (code=exited, status=0/SUCCESS)
Process: 15507 ExecStart=/etc/rc.d/init.d/jenkins start (code=exited, status=0/SUCCESS)
CGroup: /system.slice/jenkins.service
└─15528 /usr/local/jdk1.8.0_251/bin/java -Dcom.sun.akuma.Daemon=daemonized -Djava.awt.headless=true -DJENKINS_HOME=/var/lib/jenkins -j…

2月 21 15:30:37 localhost.localdomain systemd[1]: Stopped LSB: Jenkins Automation Server.
2月 21 15:30:37 localhost.localdomain systemd[1]: Starting LSB: Jenkins Automation Server…
2月 21 15:30:37 localhost.localdomain runuser[15512]: pam_unix(runuser:session): session opened for user jenkins by (uid=0)
2月 21 15:30:38 localhost.localdomain systemd[1]: Started LSB: Jenkins Automation Server.
2月 21 15:30:38 localhost.localdomain jenkins[15507]: Starting Jenkins [ 确定 ]

最后一行添加自己安装的java路径(注:一定要写道jbin/java),保存退出

再次启动jenkins

systemctl restart jenkins

systemctl status jenkins

启动成功!

附上jenkins的各文件路径:

/usr/lib/jenkins/jenkins.war WAR包

/etc/sysconfig/jenkins 配置文件

/var/lib/jenkins/ 默认的家目录

/var/log/jenkins/jenkins.log 日志文件

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值