Start/Stop and Restart Jenkins service on Windows

WindowsCommand LineConsoleJenkinsCommand Prompt

Windows Problem Overview


I have downloaded "jenkins-1.501.zip" from http://jenkins-ci.org/content/thank-you-downloading-windows-installer .

I have extracted zip file and installed Jenkins on Windows 7 successfully. Jenkins runs at http://localhost:8080/ well. I want to stop Jenkins service from console. How can I do that? What's the way to start and restart through console/command line?

Windows Solutions


Solution 1 - Windows

Open Console/Command line --> Go to your Jenkins installation directory. Execute the following commands respectively:

to stop:
jenkins.exe stop

to start:
jenkins.exe start

to restart:
jenkins.exe restart

Solution 2 - Windows

To stop Jenkins Please avoid shutting down the Java process or the Windows service. These are not usual commands. Use those only if your Jenkins is causing problems.

Use Jenkins' way to stop that protects from data loss.

http://[jenkins-server]/[command]

where [command] can be any one of the following

  • exit
  • restart
  • reload

Example: if my local PC is running Jenkins at port 8080, it will be

http://localhost:8080/exit

Solution 3 - Windows

So by default you can open CMD and write

java -jar jenkins.war

But if your port 8080 is already is in use,so you have to change the Jenkins port number, so for that open Jenkins folder in Program File and open Jenkins.XML file and change the port number such as 8088

Now Open CMD and write

java -jar jenkins.war --httpPort=8088

Solution 4 - Windows

To start Jenkins from command line

  1. Open command prompt

  2. Go to the directory where your war file is placed and run the following command:

    java -jar jenkins.war

To stop

Ctrl + C

Solution 5 - Windows

       jenkins.exe stop
       jenkins.exe start
       jenkins.exe restart

These commands will work from cmd only if you run CMD with admin permissions

Solution 6 - Windows

To Start Jenkins through Command Line

  1. Run CMD with admin

  2. You can run following commands

    "net start servicename" to start

    "net restart servicename" to restart

    "net stop servicename" to stop service

for more reference https://www.windows-commandline.com/start-stop-service-command-line/

Solution 7 - Windows

Small hints for routine work.

Create a bat file, name it and use for exact run/stop/restart Jenkins service

#!/bin/bash
# go to Jenkins folder
cd C:\Program Files (x86)\Jenkins

#to stop:
jenkins.exe stop

#to start:
#jenkins.exe start

#to restart:
#jenkins.exe restart

Solution 8 - Windows

> Step 01: You need to add jenkins for environment variables, Then you can use jenkins commands > > Step 02: Go to "C:\Program Files (x86)\Jenkins" with admin prompt > > Step 03: Choose your option: jenkins.exe stop / jenkins.exe start / jenkins.exe restart

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
Questionuser2027659View Question on Stackoverflow
Solution 1 - WindowsRipon Al WasimView Answer on Stackoverflow
Solution 2 - WindowsShantonuView Answer on Stackoverflow
Solution 3 - WindowsVishwa Deepak SinghView Answer on Stackoverflow
Solution 4 - Windowsuser108View Answer on Stackoverflow
Solution 5 - WindowsAmit JainView Answer on Stackoverflow
Solution 6 - WindowsTalib HussainView Answer on Stackoverflow
Solution 7 - WindowsRoman DenisenkoView Answer on Stackoverflow
Solution 8 - WindowsLahiru AmarathungeView Answer on Stackoverflow