Programing

Jenkins를 수동으로 다시 시작하는 방법은 무엇입니까?

lottogame 2020. 9. 29. 07:08
반응형

Jenkins를 수동으로 다시 시작하는 방법은 무엇입니까?


방금 Jenkins와 작업을 시작했고 문제가 발생했습니다. 여러 플러그인을 설치 한 후 다시 시작해야한다고 말하고 "종료"모드로 들어가지만 다시 시작하지 않습니다.

수동으로 다시 시작하려면 어떻게합니까?


Jenkins를 수동으로 다시 시작하려면 다음 명령 중 하나를 사용할 수 있습니다 (브라우저에 URL 입력).

(jenkins_url)/safeRestart-실행중인 모든 작업을 완료 할 수 있습니다. 새 작업은 다시 시작이 완료된 후 실행할 대기열에 남아 있습니다.

(jenkins_url)/restart -빌드가 완료 될 때까지 기다리지 않고 강제로 다시 시작합니다.


당신이로 설치 한 경우 RPM 이나 DEB , 다음 service jenkins restart도 작동합니다.


Ubuntu 또는 Debian에서 apt-get/를 통해 설치된 경우 dpkg:

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

SafeRestart 플러그인 언급 될 필요가있다. 매우 유용합니다 ( 안전하게 다시 시작 ). 주 메뉴에서 다시 시작할 수있는 링크를 추가합니다.

여기에 이미지 설명 입력


아래 명령은 Red Hat Linux 에서 저에게 효과적이며 Ubuntu에서도 작동합니다.

  • Jenkins의 상태를 확인하려면 :

    sudo service jenkins status
    
  • Jenkins를 시작하려면 :

    sudo service jenkins start
    
  • Jenkins를 중지하려면 :

    sudo service jenkins stop
    
  • Jenkins를 다시 시작하려면 :

    sudo service jenkins restart
    

명령 프롬프트의 데모 :

[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]#

창문을 사용하는 사람들

콘솔 / 명령 줄 열기-> Jenkins 설치 디렉터리로 이동합니다. 다음 명령을 각각 실행하십시오.

To stop:
jenkins.exe stop

To start:
jenkins.exe start

To restart:
jenkins.exe restart


(서비스로 설치 한 경우 Windows에서, 서비스로 이동 시작실행 : services.msc젠킨스, → 마우스 오른쪽 버튼으로 클릭 찾기) 다시 시작을 .

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.


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

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.


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).


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


Use the command line interface:

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

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
    

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>

If you run FreeBSD:

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

If you are able to access it in a web browser, just add /restart, for example, localhost:8080/restart.

If you are running it as a service then log in to your server and execute the command:

sudo service jenkins stop/start

For restarting Jenkins manually using the browser:

Enter your www.jenkins-ip/restart (for example, http://localhost:8080/restart) in the browser. Jenkins will restart and load the login page automatically after restart.


JenkinURL/restart will do the restart.


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

For Mac

Stop Jenkins

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

Start Jenkins

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

From the terminal:

sudo service jenkins restart

Or jenkinsurl/restart.


Several people have mentioned the need to restart the servlet container if Jenkins is not running as a standalone. But Tomcat (or what is being used) doesn't need to be restarted. Tomcat can force a restart of the Jenkins context if your Jenkins restart is hung.

But to address another comment, when you put Jenkins in the "shutting down" mode it will not actually shut down. It stops new jobs from executing and place a giant red banner on the system pages so everyone knows that the administrator wants to take it down eventually. There are plugins to trigger a servlet container restart for that context after all builds are completed.

The alternative is to wait till the last running job completes, then manually kick over Jenkins from the container (or via the command line options that others have mentioned for the standalone Jenkins install).


If it is deployed as a war file then restart the application server, for example, Tomcat.


For CentOS:

sudo systemctl restart jenkins

sudo systemctl status Jenkins

Jenkins will be active and up and running on some PID.


If it is in a Docker container, you can just restart your container. Let's assume the container name is jenkins, so you can do:

docker restart jenkins

Or

docker stop jenkins
docker start jenkins

If nothing works then find the Jenkins process by

ps aux | grep java

and then kill it:

kill -9 [PID]

sudo service jenkins start

Browse http://[jenkins-server-url]/updateCenter/ and just check 'restart jenkins'


Windows

Run services.msc and restart:

여기에 이미지 설명 입력


You have many options to restart Jenkins manually, but mainly two (URL or command line):

  1. Using the Jenkins installation URL:

    Jenkins_URL/restart. Example: http://jenkinsserver.com/restart

    This type of restart forces a restart without waiting for builds to complete.

    If you need to wait for the jobs endings you can use:

    Jenkins_URL/safeRestart. Example: http://jenkinsserver.com/safeRestart

  2. Using the command line, depending on your Jenkins installation.

    • If you're installing using rpm or deb package or you have the Jenkins installation in Red Hat, Ubuntu, or Debian, you can use these commands:

      • sudo service jenkins restart, for restarting Jenkins in one step.

      • sudo service jenkins stop and sudo service jenkins start, for restarting Jenkins in two steeps.

      Note: if you need to check the Jenkins status, you can use this command: sudo service jenkins status

    • If you are using CentOS, you can use this command:

      sudo systemctl restart jenkins
      

      Note: if you need to check the Jenkins status, you can use this command: sudo systemctl status Jenkins


Try the below. It worked for me.

sudo service jenkins status  

It will give you PID of Jenkins. Now do a

kill -15 [PID]

sudo service jenkins start

If you have no permissions or access to the command line directly, you can do e.g. one of the following:

  1. Create a job with shell/batch step that will trigger a restart from the Jenkins installation folder
  2. "설치 후 다시 시작"을 확인하면서 일부 플러그인을 설치 / 업데이트합니다 (적어도 이전 버전에서 작동 함).

위의 두 가지 모두 해킹이지만, 아무도 Jenkins를 다시 시작하기를 원하지 않는 매우 제한된 환경에서 적극적으로 사용했습니다.


Windows 컴퓨터에서 Jenkins를 서버로 실행하는 경우 작업 관리자를 열고 서비스 탭으로 전환합니다. Jenkins를 검색하고 다시 시작하십시오.

참고 URL : https://stackoverflow.com/questions/8072700/how-to-restart-jenkins-manually

반응형