.. code:: bash #!/bin/bashJENKINS_FOLDER="/shared/jenkins"
DEST_FOLDER="/jenkins-backup"
if [ ! -d "${DEST_FOLDER}" ]; then mkdir -p ${DEST_FOLDER} fi
if [ ! -d "${DEST_FOLDER}/jobs" ]; then mkdir -p ${DEST_FOLDER}/jobs fi
cd ${JENKINS_FOLDER}
pwd
/usr/bin/rsync -v -a --relative --checksum ./*.xml ${DEST_FOLDER}
/usr/bin/rsync -v -a --relative --checksum ./plugins/ ${DEST_FOLDER}/
cd ${JENKINS_FOLDER}/jobs
pwd
find . -maxdepth 2 -name "config.xml" -print0 | /usr/bin/rsync -v -a --relative --checksum --files-from=- --from0 ./ ${DEST_FOLDER}/jobs/