伪命题。用dmg装jenkins的话会产生一个shared的jenkins用户,这个很不爽。

还是都放到admin用户下统一管理为好,步骤如下:

brew install jenkins  

会装好jenkins 2.3.0

然后把plist文件拷贝到LaunchAgents目录:

cp -p /usr/local/opt/jenkins/homebrew.mxcl.jenkins.plist ~/Library/LaunchAgents  

接下来比较重要,编辑这个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>Label</key>
    <string>homebrew.mxcl.jenkins</string>
    <key>ProgramArguments</key>
    <array>
      <string>/usr/bin/java</string>
      <string>-Dfile.encoding=UTF-8</string>
      <string>-Dhttp.proxyHost=172.16.8.1</string>
      <string>-Dhttp.proxyPort=3128</string>
      <string>-Dhttps.proxyHost=172.16.8.1</string>
      <string>-Dhttps.proxyPort=3128</string>
      <string>-XX:PermSize=256m</string>
      <string>-XX:MaxPermSize=512m</string>
      <string>-Xms256m</string>
      <string>-Xmx512m</string>
      <string>-jar</string>
      <string>/usr/local/opt/jenkins/libexec/jenkins.war</string>
      <string>--httpPort=8080</string>
    </array>
    <key>RunAtLoad</key>
    <true/>
  </dict>
</plist>  

我们加了http和https的proxy,增加了文件编码,增加了java的内存选项,删除了http的监听地址,删除了smtp的starttls选项。

然后变成自动启动:

launchctl load ~/Library/LaunchAgents/homebrew.mxcl.jenkins.plist  
comments powered by Disqus