如何在不清除Jenkins安装的情况下手动重启Jenkins(Windows服务器)
Restart Jenkins on Windows Without Reinstalling
Hey there! Let me walk you through a few straightforward, safe ways to restart Jenkins on your Windows server—no need to wipe your existing installation or lose any configurations.
Method 1: Use Jenkins' Built-in Restart Endpoint
This is the easiest way if you can access the Jenkins web UI:
- Open your Jenkins dashboard (usually at
http://<your-server-ip>:8080orhttp://localhost:8080) and log in. - Append
/restartto the end of the URL in your address bar. For example:http://localhost:8080/restart - You’ll see a confirmation page—click Yes to trigger an immediate restart.
- Pro tip: If you want to wait for all running builds to finish before restarting, use
/safeRestartinstead:http://localhost:8080/safeRestart
Method 2: Restart via Windows Services
Since Jenkins typically runs as a Windows service, this method works even if the web UI is unresponsive:
- Press
Win + Rto open the Run dialog, typeservices.msc, and hit Enter. - Scroll through the list to find the service named Jenkins (if you’ve customized the service name, look for something containing "Jenkins").
- Right-click the service and select Restart from the menu. Wait a few moments for the service to stop and start back up.
Method 3: Use Command Line (CMD/PowerShell)
If you prefer using the terminal, these commands will get the job done:
Using Command Prompt (CMD)
- Open CMD as Administrator.
- Stop the Jenkins service first:
net stop Jenkins - Once it’s stopped, start it back up:
net start Jenkins
Using PowerShell
- Open PowerShell as Administrator.
- You can restart the service in one line:
Restart-Service Jenkins - If you’re unsure of the exact service name, run this to find it:
Use theGet-Service | Where-Object {$_.DisplayName -like "*Jenkins*"}Namevalue from the output in place of "Jenkins" in the restart command.
Quick Notes
- Always check if there are active builds running before restarting. The
/safeRestartoption or waiting for builds to finish helps avoid broken builds or data loss. - If Jenkins is frozen and the web UI isn’t loading, the Windows Services or command line methods are your best bet—they’ll force the service to restart regardless of the UI state.
内容的提问来源于stack exchange,提问作者Gayanjani Gamage
相关产品推荐
相关产品推荐

