Created
April 4, 2012 16:48
-
-
Save johanneswseitz/2303751 to your computer and use it in GitHub Desktop.
Change Jenkins User
This file contains hidden or 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 | |
#Execute with curl -sL https://raw.github.com/gist/2303751/fix-jenkins.sh | sudo sh | |
PLIST_PATH=/Library/LaunchDaemons/org.jenkins-ci | |
JENKINS_HOME=/Users/Shared/Jenkins/Home | |
if [[ $EUID -ne 0 ]]; then | |
echo "Execute this script with sudo" | |
else | |
echo "Jenkins will run as" $SUDO_USER | |
defaults write $PLIST_PATH UserName $SUDO_USER | |
defaults write $PLIST_PATH GroupName staff | |
echo "Changing owner of JENKINS_HOME" | |
chown -hR "$SUDO_USER:staff" $JENKINS_HOME | |
echo "Restarting Jenkins..." | |
launchctl unload "$PLIST_PATH.plist" | |
launchctl load "$PLIST_PATH.plist" | |
echo "Done!" | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment