Skip to content

Commit

Permalink
Fix error when nodes dir is empty #37
Browse files Browse the repository at this point in the history
  • Loading branch information
sue445 committed Mar 27, 2016
1 parent 7ca528f commit 28cf815
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions jenkins-backup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -31,19 +31,19 @@ if [ $hpi_pinned_count -ne 0 -o $jpi_pinned_count -ne 0 ]; then
cp "$JENKINS_HOME/plugins/"*.[hj]pi.pinned "$ARC_DIR/plugins"
fi

if [ -d "$JENKINS_HOME/users/" ] ; then
if [ "$(ls -A $JENKINS_HOME/users/)" ]; then
cp -R "$JENKINS_HOME/users/"* "$ARC_DIR/users"
fi

if [ -d "$JENKINS_HOME/secrets/" ] ; then
if [ "$(ls -A $JENKINS_HOME/secrets/)" ] ; then
cp -R "$JENKINS_HOME/secrets/"* "$ARC_DIR/secrets"
fi

if [ -d "$JENKINS_HOME/nodes/" ] ; then
if [ "$(ls -A $JENKINS_HOME/nodes/)" ] ; then
cp -R "$JENKINS_HOME/nodes/"* "$ARC_DIR/nodes"
fi

if [ -d "$JENKINS_HOME/jobs/" ] ; then
if [ "$(ls -A $JENKINS_HOME/jobs/)" ] ; then
cd "$JENKINS_HOME/jobs/"
ls -1 | while read job_name ; do
mkdir -p "$ARC_DIR/jobs/$job_name/"
Expand Down

0 comments on commit 28cf815

Please sign in to comment.