Jenkins加入systemd服务并设置为开机自启动

[root@devops ~]# cat /data/jenkins/startup.sh
#!/bin/sh
source /etc/profile
java -jar /data/jenkins/jenkins.war  --httpPort=8080 --logfile=/data/jenkins/log
[root@devops ~]# cat /data/jenkins/shutdown.sh
#/bin/sh
# 使用fuser关闭占用端口的程序
fuser -k 8080/tcp
[root@devops ~]# cat /usr/lib/systemd/system/jenkins.service
[Unit]
Description=jenkins project
After=network.target

[Service]
Type=simple

ExecStart=/data/jenkins/startup.sh
ExecReload=
ExecStop=/data/jenkins/shutdown.sh
PrivateTmp=true
systemctl enable jenkins
阅读剩余
THE END