Skip to content

Instantly share code, notes, and snippets.

@rpavlik
Created April 18, 2014 17:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rpavlik/11055110 to your computer and use it in GitHub Desktop.
Save rpavlik/11055110 to your computer and use it in GitHub Desktop.
Script for migrating just the basics of a Jenkins install
#!/bin/sh
SRCROOT=/media/da1ca593-583a-4f78-be0a-b0b628d726a4/var/lib/jenkins
DESTROOT=/var/lib/jenkins
SRCJOBS=${SRCROOT}/jobs
DESTJOBS=${DESTROOT}/jobs
for SRC in ${SRCJOBS}/*; do
if [ -d "${SRC}" -a -f "${SRC}/config.xml" ]; then
jobname=$(basename ${SRC})
DEST="${DESTJOBS}/${jobname}"
[ -d "${DEST}" ] || mkdir -p "${DEST}"
[ -f "${DESTJOBS}/${jobname}/config.xml" ] || (echo Copying config ${jobname}; cp "${SRCJOBS}/${jobname}/config.xml" "${DESTJOBS}/${jobname}/config.xml")
fi
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment