如何在 Mac OS X 系统上在不同的 HTTP 端口(即 7070 和 7071)上运行 Jenkins 的两个守护进程。
1)我为每个 dameon 创建了两个帐户,包含 Jenkins 主目录:jeankins1、jenkins2
2) 我复制了默认的 dameon 配置文件
sudo cp /Library/LaunchDaemons/org.jenkins-ci.plist /Library/LaunchDaemons/jenkins-dameon-1.plist
sudo cp /Library/LaunchDaemons/org.jenkins-ci.plist /Library/LaunchDaemons/jenkins-dameon-2.plist
3)我修改了dameon配置文件
sudo vi /Library/LaunchDaemons/jenkins-dameon-1.plist
jenkins-dameon-1.plist 文件的内容:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>EnvironmentVariables</key>
<dict>
<key>JENKINS_HOME</key>
<string>/Users/jenkins1/Jenkins/Home</string>
</dict>
<key>GroupName</key>
<string>wheel</string>
<key>KeepAlive</key>
<true/>
<key>Label</key>
<string>org.jenkins-ci</string>
<key>ProgramArguments</key>
<array>
<string>/bin/bash</string>
<string>/Library/Application Support/Jenkins/jenkins-runner.sh</string>
<string>--httpPort=7070</string>
</array>
<key>RunAtLoad</key>
<true/>
<key>UserName</key>
<string>jenkins1</string>
<key>SessionCreate</key>
<true />
</dict>
sudo vi /Library/LaunchDaemons/jenkins-dameon-2.plist
jenkins-dameon-2.plist 文件的内容:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>EnvironmentVariables</key>
<dict>
<key>JENKINS_HOME</key>
<string>/Users/jenkins2/Jenkins/Home</string>
</dict>
<key>GroupName</key>
<string>wheel</string>
<key>KeepAlive</key>
<true/>
<key>Label</key>
<string>org.jenkins-ci</string>
<key>ProgramArguments</key>
<array>
<string>/bin/bash</string>
<string>/Library/Application Support/Jenkins/jenkins-runner.sh</string>
<string>--httpPort=7071</string>
</array>
<key>RunAtLoad</key>
<true/>
<key>UserName</key>
<string>jenkins2</string>
<key>SessionCreate</key>
<true />
</dict>
4) 我启动了两个 Jenkins 守护进程
sudo launchctl load /Library/LaunchDaemons/jenkins-dameon-1.plist
sudo launchctl load /Library/LaunchDaemons/jenkins-dameon-2.plist
我传递 httpPort 参数的方式似乎不正确,怎么办?
此解决方案仅适用于一个实例:Configure Jenkins Mac OS X native package to run in a different port