Skip to content

Instantly share code, notes, and snippets.

@nicopaez
Last active August 29, 2015 14:01
Show Gist options
  • Save nicopaez/60ebad4311d691e803d1 to your computer and use it in GitHub Desktop.
Save nicopaez/60ebad4311d691e803d1 to your computer and use it in GitHub Desktop.
Jenkins backup script
#!/bin/bash
set -e
cd /var/lib/jenkins/jobs
cp --parent ./*/config.xml /var/jenkins-backup/repo
cd /var/jenkins-backup/repo
git add .
git commit -m "Config files updated"
git push origin master
chmod +x backup_jenkins.sh
crontab -e
0 2 * * * /var/jenkins-backup/backup-jenkins.sh
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment