How to restart Jenkins manually?

How to restart Jenkins manually?

I've just started working with Jenkins and have run into a problem. After installing several plugins it said it needs to be restarted and went into a "shutting down" mode, but never restarts.
How do I do a manual restart?

Solutions/Answers:

Solution 1:

To restart Jenkins manually, you can use either of the following commands (by entering their URL in a browser):

(jenkins_url)/safeRestart – Allows all running jobs to complete. New jobs will remain in the queue to run after the restart is complete.

(jenkins_url)/restart – Forces a restart without waiting for builds to complete.

Solution 2:

If you installed as a rpm or deb, then service jenkins restart will work also.

Solution 3:

On Ubuntu or Debian, when installed through apt-get/dpkg:

$ sudo /etc/init.d/jenkins restart
Usage: /etc/init.d/jenkins {start|stop|status|restart|force-reload}

Solution 4:

The SafeRestart Plugin needs to be mentioned. It is pretty useful (Restart Safely). It adds a link to be able to restart from the main menu:

Enter image description here

Solution 5:

The below commands worked for me in Red Hat Linux and should work for Ubuntu also.

  • To know the status of Jenkins:

    sudo service jenkins status
    
  • To start the Jenkins:

    sudo service jenkins start
    
  • To stop the Jenkins:

    sudo service jenkins stop
    
  • To restart the Jenkins:

    sudo service jenkins restart
    

Demo on command prompt:

[root@varunHome]# sudo service jenkins status
jenkins (pid  7468) is running...

[root@varunHome]# sudo service jenkins stop
Shutting down Jenkins               [  OK  ]

[root@varunHome]# sudo service jenkins start
Starting Jenkins                    [  OK  ]

[root@varunHome]# sudo service jenkins restart
Shutting down Jenkins               [  OK  ]

Starting Jenkins                    [  OK  ]
[root@varunHome]#

The folks who are using 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 6:

On Windows, if you installed it as a service, go to Services (StartRun: services.msc),
find Jenkins, right click → Restart.

If it does not help (UI is not responding) open the Windows Task Manager → Processes, kill the java.exe process, and restart the service once again.

Solution 7:

If you’re running Jenkins on Mac OS X then you can manually stop the service by executing this command:

sudo launchctl unload /Library/LaunchDaemons/org.jenkins-ci.plist

Solution 8:

This can also be done using the Jenkins CLI:

java -jar jenkins-cli.jar -s http://[jenkins-server]/ restart

The jenkins-cli.jar file along with a full list of commands are available at http://[jenkins-server]/cli.

Solution 9:

If you want to just reload the configuration file, one can do

    <jenkins_url>/reload

This is quicker if you have made some small change in the configuration file, like config.xml directly in the file system or made copies of the job through the filesystem (not through the browser).

Solution 10:

It depends on how Jenkins has been started.

  • As a service: sudo service jenkins restart, sudo /etc/init.d/jenkins restart, etc.

  • As a web application in a Tomcat installation: restart your Tomcat, or just restart the application in Tomcat. Go to http://<tomcat-server>:8080/manager/list or after authentication hit http://<tomcat-server>:8080/manager/stop?path=/myapp+ http://<tomcat-server>:8080/manager/start?path=/myapp.

  • Launched with just java -jar: kill it (kill -9 <pid>), and relaunch it.

  • Launched with java -jar, but from a supervisor: supervisorctl restart jenkins

Solution 11:

Use the command line interface:

java -jar jenkins-cli.jar -s http://jenkins.example.com:8080/ -i /root/.ssh/id_rsa safe-restart

Solution 12:

On Windows

Go to the Jenkins installation, open the cmd and run:

  • To stop:

    jenkins.exe stop
    
  • To start:

    jenkins.exe start
    
  • To restart:

    jenkins.exe restart
    

Solution 13:

Sometimes there will be some stale Jenkins processes, so ps -ef | grep jenkins kill all of them. Restart as described in previous answers, and it will be clean.

ps -ef | grep jenkins
sudo kill -kill <pid>

Solution 14:

If you run FreeBSD:

/usr/local/etc/rc.d/jenkins restart

References

Loading...