-
-
Save alexmerser/1444c2754ef25b5d318c to your computer and use it in GitHub Desktop.
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/sh | |
# directory that contains the jenkins.war | |
JENKINS_WAR_DIR=/usr/share/jenkins | |
# Absolute path the jenkins.war | |
JENKINS_WAR=${JENKINS_WAR_DIR}/jenkins.war | |
# Absolute path the jenkins.war for backup | |
JENKINS_BACKUP_WAR=/tmp/jenkins.war.bak | |
# latast jenkins.war | |
JENKINS_LATEST_WAR_URL=http://updates.jenkins-ci.org/latest/jenkins.war | |
# Absolute path the downloaded jenkins.war | |
DOWNLOADED_WAR=${WORKSPACE}/jenkins.war | |
# backup | |
rm -f ${JENKINS_BACKUP_WAR} | |
cp ${JENKINS_WAR} ${JENKINS_BACKUP_WAR} | |
# get latest war | |
rm -f ${DOWNLOADED_WAR} | |
wget ${JENKINS_LATEST_WAR_URL} --no-check-certificate | |
# replace to the new war | |
rm -f ${JENKINS_WAR} | |
cp ${DOWNLOADED_WAR} ${JENKINS_WAR} | |
#safe restart | |
service jenkins restart |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment