Jenkins加入systemctl管理

  Jenkins安装目录为 /usr/local/jenkins-tomcat/

  添加文档

/usr/lib/systemd/system/jenkins.service

  

[Unit]
Description=jenkins
After=network.target

[Service]
Type=forking
#PIDFile=/usr/local/tomcat/tomcat.pid
ExecStart=/usr/local/jenkins-tomcat/bin/startup.sh
ExecReload=
ExecStop=/usr/local/jenkins-tomcat/bin/shutdown.sh
PrivateTmp=true

[Install]
WantedBy=multi-user.target

  重新导入systemctl

 systemctl daemon-reload

  手动关闭jenkins然后使用systemctl启动并且添加至自启动

 /usr/local/jenkins-tomcat/bin/shutdown.sh
systemctl start jenkins
systemctl enable jenkins

  

posted @ 2019-06-06 13:45  minseo  阅读(3143)  评论(0编辑  收藏  举报