Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Minor shell cleanups #9

Merged
merged 2 commits into from
Nov 7, 2014
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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