Categories
Linux

Jenkins Centos Systemctl Automatic Restart

sudo nano /etc/systemd/system/jenkins.service

Paste the below code in /etc/systemd/system/jenkins.service
Ctrl + O to save
Ctrl + X to exit

[Unit]
Description=Jenkins Server Daemon
Wants=network-online.target
After=network-online.target

[Service]
ExecStart=/etc/init.d/jenkins start
Restart=always
RestartSec=3
Type=forking

[Install]
WantedBy=multi-user.target
sudo systemctl enable jenkins.service

To check the list

chkconfig --list