Skip to content

Commit

Permalink
Merge pull request #9 from SEJeff/patch-1
Browse files Browse the repository at this point in the history
Minor shell cleanups
  • Loading branch information
sue445 committed Nov 7, 2014
2 parents 9f60616 + 5bbb4ba commit 8741649
Showing 1 changed file with 3 additions and 7 deletions.
10 changes: 3 additions & 7 deletions jenkins-backup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

##################################################################################
function usage(){
echo "usage: ./jenkins-backup.sh /path/to/jenkins_home archive.tar.gz"
echo "usage: $(basename $0) /path/to/jenkins_home archive.tar.gz"
}
##################################################################################

Expand All @@ -15,17 +15,15 @@ readonly ARC_DIR="$TMP_DIR/$ARC_NAME"
readonly TMP_TAR_NAME="archive.tar.gz"

if [ -z "$JENKINS_HOME" -o -z "$DIST_FILE" ] ; then
usage
usage >&2
exit 1
fi

if [[ -f "$TMP_DIR/$TMP_TAR_NAME" ]]; then
rm $TMP_DIR/$TMP_TAR_NAME
fi
rm -rf $ARC_DIR
mkdir -p $ARC_DIR/plugins
mkdir -p $ARC_DIR/jobs
mkdir -p $ARC_DIR/users
mkdir -p $ARC_DIR/{plugins,jobs,users}

cp $JENKINS_HOME/*.xml $ARC_DIR
cp $JENKINS_HOME/plugins/*.jpi $ARC_DIR/plugins
Expand All @@ -41,5 +39,3 @@ done
cd $TMP_DIR
tar czvf $TMP_TAR_NAME $ARC_NAME/*
cp $TMP_DIR/$TMP_TAR_NAME $DIST_FILE

exit 0

0 comments on commit 8741649

Please sign in to comment.