Created
April 3, 2013 05:40
-
-
Save DerekK19/5298707 to your computer and use it in GitHub Desktop.
Daemon processes to run Jenkins. This is the only configuration I have found that works: A Daemon config file (plist) will run as root and will launch a shell script. That shell script runs a second shell script as the _jenkins user. This configuration ensures that the launch-slave script is running as the _jenkins user and has got a correct run…
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
LOG=/Developer/jenkins/logs/slave.log | |
sudo rm -f $LOG | |
date >$LOG | |
chmod 777 $LOG | |
echo ============================= >> $LOG | |
echo whoami >> $LOG | |
whoami >> $LOG | |
echo env >>$LOG | |
env >> $LOG | |
sudo su - _jenkins -c /Developer/jenkins/launch-slave >>$LOG 2>&1 | |
manderley:jenkins derek$ cat /Developer/jenkins/launch-slave | |
#!/bin/bash | |
LOG=/Developer/jenkins/logs/slave.log | |
echo >>$LOG | |
date >>$LOG | |
echo ============================= >> $LOG | |
echo whoami >>$LOG | |
whoami >>$LOG | |
echo >>$LOG | |
echo pwd >>$LOG | |
pwd >>$LOG | |
echo >>$LOG | |
echo env >>$LOG | |
env >>$LOG | |
JAVA_HOME=/opt/SUN/jdk1.6.0_04 | |
JAVA_HOME=/usr | |
PATH=$PATH:$JAVA_HOME/bin | |
HOME=/Developer/jenkins | |
export HOME | |
export PATH | |
echo >>$LOG | |
echo xcode-select -print-path >>$LOG | |
xcode-select -print-path >>$LOG | |
echo >>$LOG | |
echo security list-keychains >>$LOG | |
security list-keychains >>$LOG | |
echo security login-keychain >>$LOG | |
security login-keychain >>$LOG | |
echo security default-keychain >>$LOG | |
security default-keychain >>$LOG | |
##echo >>$LOG | |
##echo unlocking login keychain >>$LOG | |
##security unlock-keychain -p jenkins /Developer/jenkins/Library/Keychains/login.keychain >>$LOG 2>&1 | |
##echo setting keychain search list >>$LOG | |
##security list-keychains -d user -s /Developer/jenkins/Library/Keychains/login.keychain >>$LOG 2>&1 | |
##echo setting default keychain >>$LOG | |
##security default-keychain -d user -s /Developer/jenkins/Library/Keychains/login.keychain >>$LOG 2>&1 | |
#3echo setting login ketchain >>$LOG | |
##security login-keychain -d user -s /Developer/jenkins/Library/Keychains/login.keychain >>$LOG 2>&1 | |
## | |
##echo >>$LOG | |
##echo security list-keychains >>$LOG | |
##security list-keychains >>$LOG | |
##echo security login-keychain >>$LOG | |
##security login-keychain >>$LOG | |
##echo security default-keychain >>$LOG | |
##security default-keychain >>$LOG | |
echo >>$LOG | |
java -version >>$LOG 2>&1 | |
echo Starting Jenkins slave process >>$LOG | |
echo >>$LOG | |
echo java -Djava.awt.headless=true -jar /Developer/jenkins/slave.jar -jnlpUrl http://jenkins.lizderekgordonknight.co.uk/computer/Manderley/slave-agent.jnlp >>$LOG 2>&1 | |
java -Djava.awt.headless=true -jar /Developer/jenkins/slave.jar -jnlpUrl http://jenkins.lizderekgordonknight.co.uk/computer/Manderley/slave-agent.jnlp >>$LOG 2>&1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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>/Developer/jenkins</string> | |
</dict> | |
<key>KeepAlive</key> | |
<true/> | |
<key>Label</key> | |
<string>org.jenkins-ci</string> | |
<key>ProgramArguments</key> | |
<array> | |
<string>/bin/sh</string> | |
<string>/Developer/jenkins/root-launcher</string> | |
</array> | |
<key>RunAtLoad</key> | |
<true/> | |
<key>StandardOutPath</key> | |
<string>/Developer/jenkins/logs/launch.log</string> | |
<key>StandardErrorPath</key> | |
<string>/Developer/jenkins/logs/launch.log</string> | |
</dict> | |
</plist> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
LOG=/Developer/jenkins/logs/slave.log | |
sudo rm -f $LOG | |
date >$LOG | |
chmod 777 $LOG | |
echo ============================= >> $LOG | |
echo whoami >> $LOG | |
whoami >> $LOG | |
echo env >>$LOG | |
env >> $LOG | |
sudo su - _jenkins -c /Developer/jenkins/launch-slave >>$LOG 2>&1 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment