Created
March 4, 2017 08:22
-
-
Save brandhill/235bac634e10d324dd26e1e5675bfe0b to your computer and use it in GitHub Desktop.
the script to update jenkins
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 | |
DEFAULT_URL=http://updates.jenkins-ci.org/current/latest/jenkins.war | |
TMP_PATH=/tmp/jenkins.war | |
APP_PATH=/Applications/Jenkins/jenkins.war | |
PLIST_PATH=/Library/LaunchDaemons/org.jenkins-ci.plist | |
url=${1-$DEFAULT_URL} | |
echo 'Downloading WAR package...' | |
curl -# $url > $TMP_PATH | |
if [ $? -ne 0 ]; then | |
echo 'Fail to download WAR package.' | |
exit 1 | |
fi | |
echo 'Applying update...' | |
sudo -s -- <<EOF | |
launchctl unload $PLIST_PATH | |
mv -f $APP_PATH $APP_PATH.bak | |
mv $TMP_PATH $APP_PATH | |
chown root:wheel $APP_PATH | |
launchctl load $PLIST_PATH | |
EOF |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment