Member-only story

Setup Jenkins to autostart after windows restart/reboot

Donald Le
2 min readSep 25, 2019

--

Hello folks

Recently, I need to setup Jenkins as implementation for automation test on browser on different OS.

One of the problem is that when I restart the master node, the Jenkins is restarted too but almost all of the jobs and builds.

If you met this problem, I have a workaround.

Instead of auto run the Jenkins like configuration in jenkins.xml, I run the batch file after the windows restarted automatically.

We will need to do 2 things.

1.Disable the auto run for jenkins in jenkins.xml

jenkins.xml as in my case is located in C:\Program Files (x86)\Jenkins

jenkins.xml file looks like this:

<service>
<id>Jenkins</id>
<name>Jenkins</name>
<description>This service runs Jenkins automation server.</description>
<env name="JENKINS_HOME" value="%BASE%"/>
<!--
if you'd like to run Jenkins with a specific version of Java, specify a full path to java.exe.
The following value assumes that you have java in your PATH.
-->
<executable>%BASE%\jre\bin\java</executable>
<arguments>-Xrs -Xmx256m -Dhudson.lifecycle=hudson.lifecycle.WindowsServiceLifecycle -jar "%BASE%\jenkins.war" --httpPort=8080 --webroot="%BASE%\war"</arguments>

--

--

Donald Le
Donald Le

Written by Donald Le

A passionate automation engineer who strongly believes in “A man can do anything he wants if he puts in the work”.

No responses yet