运维开发网
广告位招商联系QQ:123077622
 
广告位招商联系QQ:123077622

jenkins修改JENKINS_HOME及自启动配置

运维开发网 https://www.qedev.com 2021-05-09 12:58 出处:51CTO 作者:喵来个鱼
jenkins修改JENKINS_HOME及自启动配置,实践出真知原创的Linux文章。

迁移

JENKINS_HOME默认是在~/.jenkins

如果磁盘不足可以迁移或设置在别的目录

echo "JENKINS_HOME=/data/jenkins_data/" >> /etc/profile
source /etc/profile

关闭重新启动Jenkins即可

/data/jenkins-15679/apache-tomcat-8.5.64/bin/shutdown.sh
/data/jenkins-15679/apache-tomcat-8.5.64/bin/startup.sh

自启动

cat > /data/jenkins-15679/apache-tomcat-8.5.64/bin/setenv.sh <<EOF
#add tomcat pid
CATALINA_PID="/data/jenkins-15679/apache-tomcat-8.5.64/jenkins.pid"
export  JAVA_HOME=/usr/local/jdk
export  JRE_HOME=/usr/local/jdk/jre
export JENKINS_HOME=/data/jenkins_data/
EOF
cat > /usr/lib/systemd/system/jenkins.service << EOF
[Unit]
Description=tomcat of jenkins
After=syslog.target network.target remote-fs.target nss-lookup.target
# conf service pid, start,stop and restart
[Service]
Type=forking
PIDFile=/data/jenkins-15679/apache-tomcat-8.5.64/jenkins.pid
ExecStart=/data/jenkins-15679/apache-tomcat-8.5.64/bin/startup.sh
ExecStop=/data/jenkins-15679/apache-tomcat-8.5.64/bin/shutdown.sh
ExecReload=/bin/kill -s HUP
PrivateTmp=true
# conf user
[Install]
WantedBy=multi-user.target
EOF
systemctl daemon-reload
/data/jenkins-15679/apache-tomcat-8.5.64/bin/shutdown.sh
systemctl start jenkins
systemctl enablejenkins

扫码领视频副本.gif

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号