Skip to content

Instantly share code, notes, and snippets.

@philosuke
Created November 13, 2012 03:26
Show Gist options
  • Save philosuke/4063757 to your computer and use it in GitHub Desktop.
Save philosuke/4063757 to your computer and use it in GitHub Desktop.
upgrade jenkins
#! /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