Created
December 18, 2014 16:36
-
-
Save dmotylev/4f9c29f9cf31401511b9 to your computer and use it in GitHub Desktop.
Builds a jenkins-config.tar.gz in current directory. The archive includes full JENKINS_HOME but builds/ and workspaces/.
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 | |
readonly jenkins_data=/var/lib/jenkins | |
readonly jenkins_data_escaped=$(echo $jenkins_data | sed -E 's/\//\\\//g') | |
readonly filelist=$(mktemp) | |
find $jenkins_data | | |
sed -E " | |
s/^$jenkins_data_escaped\///; | |
/^${jenkins_data_escaped}$/d; | |
/^jobs\/.*?\/(builds|workspace|last.*)/d; | |
/^(\.java|log|updates).*/d; | |
/^.*\.bak$/d | |
/jenkins-config\.tar\.gz/d | |
" > $filelist | |
tar --create --gzip --file jenkins-config.tar.gz \ | |
--directory=$jenkins_data/ --no-recursion --files-from=$filelist | |
rm $filelist |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment