jenkins修改JENKINS_HOME及自啓動配置

遷移

JENKINS_HOME默認是在~/.jenkinsapache

若是磁盤不足能夠遷移或設置在別的目錄tomcat

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

關閉從新啓動Jenkins便可ide

/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
相關文章
相關標籤/搜索