1)问题: 文字描述: jenkins.service - LSB: Jenkins Automation Server Loaded: loaded (/etc/rc.d/init.d/jenkins; bad; vendor preset: disabled) Active: active (exited) since 一 2022-06-27 07:51:37 CST; 8min ago Docs: man:systemd-sysv-generator(8) Process: 30723 ExecStart=/etc/rc.d/init.d/jenkins start (code=exited, status=0/SUCCESS) systemd[1]: Starting LSB: Jenkins Automation Server… runuser[30728]: pam_unix(runuser:session): session opened for user root by (uid=0) jenkins[30723]: Starting Jenkins [ OK ] systemd[1]: Started LSB: Jenkins Automation Server.
大致的意思是: 可能是 jenkins 默认系统用户 jenkins 没有权限创建所需的日志目录,导致无法启动。 所以 我们要对 jenkins 用户授权。
如果 你将 jenkins 用户改为 root : vim /etc/sysconfig/jenkins #JENKINS_USER=“jenkins” JENKINS_USER=“root” #这里改为root 会省去很多权限的麻烦 JENKINS_PORT=“8088” 启动 jenkins 服务有可能不会遇到这个问题,但也可能配置没生效,也会遇到问题。 那么就要 对 jenkins 用户授权。【见解决命令】
图片描述: 2)解决步骤: 解决命令:
chown -R jenkins:jenkins /var/lib/jenkins
chown -R jenkins:jenkins /var/cache/jenkins
chown -R jenkins:jenkins /var/log/jenkins
systemctl restart jenkins
3)运行结果:
详情参考: https://stackoverflow.com/questions/42607771/jenkins-active-exited
|