Created
March 16, 2020 16:58
-
-
Save vokiel/d9f56bc9b076c3b76a0e3b737abcf6dc to your computer and use it in GitHub Desktop.
Update Jenkins
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 | |
if [ $# -lt 1 ] ; then | |
printf "%s\n" "Usage: $0 version" | |
exit 1 | |
fi | |
VERSION=$1 | |
JENKINS_FILE="jenkins.war_$VERSION.bak" | |
echo "Updating Jenkins to ${VERSION}" | |
cd /usr/lib/jenkins/ | |
echo "Existing backup versions:" | |
ls | |
echo "Downloading new version to jenkins.war_${VERSION}.bak" | |
wget -O "$JENKINS_FILE" "http://updates.jenkins-ci.org/download/war/${VERSION}/jenkins.war" | |
echo "Existing versions:" | |
ls -lah | |
echo "Stopping Jenkins service" | |
service jenkins stop | |
echo "Replacing old jenkins.war with new one" | |
cp "$JENKINS_FILE" "jenkins.war" | |
echo "Starging Jenkins service" | |
service jenkins start | |
echo "All done." |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment