Install Jenkins as a Windows service:
If you installed Jenkins using the windows installer, you shouldn’t need to do anything else here because the windows installer automatically runs Jenkins as a windows service.
First, you need to start Jenkins before installing it. This can be done from JNLP, or by running “
java -jar jenkins.war“.
Now connect to Jenkins by going to the following URL http://<hostname>:8080/ (hostname can be localhost / IP address / machine name) Once Jenkins is started this way, look for the “Install as Windows Service” link in the “Manage Jenkins” page.
Clicking this (Install as Windows Service) link shows you the installation screen
The “Install as Windows Service” link indicated above will not appear if Jenkins is already running as a service on the machine. As you can see below image
You can verify that Jenkins is running as a service by launching the Services app from the Windows Start Menu and looking for a running service called “jenkins” (default service name for Jenkins) among the list of all windows services running on the machine.
Choose the directory where Jenkins shall be installed (directory must already exist. If not create it beforehand). This will become
JENKINS_HOME and used to store data files and programs alike.
Upon successful completion of the installation, you should see a page asking you to restart Jenkins
This is to re-launch Jenkins as a newly installed Windows service. When you click yes, you’ll be asked to wait until the restart completes:
At this point you can use the service manager to confirm that Jenkins is running as a service.
Now you Jenkins restart itself whenever you system reboot.