#### 迁移 `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 < /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 ```