如何阻止詹金斯安装在 Mac 雪豹?

我已经在 OSX 上安装了 Jenkins 可执行文件,但是现在我想停止它的运行。只要我杀了它,不管怎样,它都会立刻重启。

我试过在 Jenkins 的网址上使用 exit 命令:

http://localhost:8080/exit

它要求我发布命令,我照做了,然后服务器按要求关闭

我尝试使用 ps搜索进程 id,并强制终止它(kill -9 pid) ,然后服务器按照请求立即关闭。但之后又重新开始了。

我试过通过 GUI 关闭它,但不幸的是,似乎没有办法做到这一点。

一定有一个守护进程的地方,使这成为一个通用的 OSX 问题。

72708 次浏览

Just unload the plist using launchctl

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

For 1.505 you can use web api

http://localhost:8080/exit
http://localhost:8080/restart
http://localhost:8080/reload

Note, that if you wish also to disable running Jenkins on Mac OS start up, according to http://halyph.blogspot.ru/2013/03/jenkins-on-mac-os-x-tips-and-tricks.html you should do:

sudo defaults write /Library/LaunchDaemons/org.jenkins-ci RunAtLoad -bool NO

UPD: didn't work for me (

I had to unload/load the LaunchAgents:

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

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

I'm on Sierra (10.12.3).

There are two things going on.

(1) will your system start Jenkins when it comes up. Controlled by load and unload.

(2) Is Jenkins currently running or not. Controlled by start and stop.

Jenkins unload stops it and it won't load again on boot up

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

stop it without unloading it ( will load again when you reboot)

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

load it - starts it and will restart whenever your system boots

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

restarts it, doesn't effect loaded or unloaded status

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

use launchctl unload /Users/<user>/Library/LaunchAgents/homebrew.mxcl.jenkins.plist

  • Start Jenkins service: brew services start jenkins-lts
  • Stop Jenkins service: brew services stop jenkins-lts
  • Restart Jenkins service: brew services restart jenkins-lts
  1. sudo launchctl unload /Library/LaunchDaemons/org.jenkins-ci.plist

  2. UI -> jenkins --> manage jenkins --> prepare for shutdown

  3. brew services stop jenkins --all

Jenkins commands for Mac for M1 and Intel

Start Jenkins service   : brew services start jenkins-lts
Stop Jenkins service    : brew services stop jenkins-lts
Restart Jenkins service : brew services restart jenkins-lts