Skip to content

Instantly share code, notes, and snippets.

@laiso
Created January 16, 2012 05:12
Show Gist options
  • Save laiso/1619173 to your computer and use it in GitHub Desktop.
Save laiso/1619173 to your computer and use it in GitHub Desktop.
jenkins をOS X のログインユーザー権限のデーモンで自動起動しておく設定
launchctl load -wF -D user ~/Library/LaunchAgents/jenkins.plist
launchctl list | grep jenkins
# 58066 - jenkins
launchctl start jenkins
open http://localhost:8080/
#!/bin/bash
#
# Startup script used by Jenkins launchd job.
# Mac OS X launchd process calls this script to customize
# the java process command line used to run Jenkins.
#-
# Customizable parameters are found in
# ~/Library/Preferences/jenkins.plist
#
# You can manipulate it using the "defaults" utility.
# See "man defaults" for details.
defaults="defaults read ~/Library/Preferences/jenkins"
war=`$defaults war` || war="${HOME}/lib/java/jenkins.war"
javaArgs=""
heapSize=`$defaults heapSize` && javaArgs="$javaArgs -Xmx${heapSize}"
home=`$defaults JENKINS_HOME` && export JENKINS_HOME="$home"
add_to_args() {
val=`$defaults $1` && args="$args --${1}=${val}"
}
args=""
add_to_args prefix
add_to_args httpPort
add_to_args httpListenAddress
add_to_args httpsPort
add_to_args httpsListenAddress
add_to_args ajp13Port
add_to_args ajp13ListenAddress
echo "JENKINS_HOME=$JENKINS_HOME"
echo "Jenkins command line for execution:"
echo /usr/bin/java $javaArgs -jar "$war" $args
exec /usr/bin/java $javaArgs -jar "$war" $args
<?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>${HOME}/.jenkins</string>
</dict>
<key>GroupName</key>
<string>staff</string>
<key>KeepAlive</key>
<true/>
<key>Label</key>
<string>jenkins</string>
<key>ProgramArguments</key>
<array>
<string>/bin/bash</string>
<string>${HOME}/bin/jenkins-runner.sh</string>
</array>
<key>RunAtLoad</key>
<true/>
<key>UserName</key>
<string>${USER}</string>
</dict>
</plist>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment