Skip to content

Instantly share code, notes, and snippets.

@flyudvik
Last active September 24, 2018 06:07
Show Gist options
  • Save flyudvik/3e3777faaee3142686134812deb76c27 to your computer and use it in GitHub Desktop.
Save flyudvik/3e3777faaee3142686134812deb76c27 to your computer and use it in GitHub Desktop.
Update jenkins through jenkins.war file. Usage: update_jenkins.sh http://updates.jenkins-ci.org/download/war/2.107.2/jenkins.war
#!/usr/bin/env bash
echo "Backing up the jenkins.war"
sudo cp /usr/share/jenkins/jenkins.war /usr/share/jenkins/jenkins.war.backup_$(date +'%m_%dT%H_%M_%S')
echo !!
echo "Downloading the new version"
sudo wget http://mirrors.jenkins-ci.org/war/latest/jenkins.war -O /usr/share/jenkins/jenkins.war
sudo systemctl stop jenkins
sudo systemctl start jenkins
echo "Reload completed. Checking status"
sudo systemctl status jenkins
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment