[ovirt] #47: add daily backup for jenkins conf
ovirt
trac at fedorahosted.org
Mon May 6 11:11:31 UTC 2013
#47: add daily backup for jenkins conf
----------------------+------------------------------------
Reporter: eedri | Owner: infra@…
Type: task | Status: new
Priority: major | Milestone: oVirt 3.3
Component: Jenkins | Version: Production
Severity: High | Keywords: jenkins, infra, backup
Blocked By: | Blocking:
----------------------+------------------------------------
- create a job in jenkins to backup conf (prefferably to a second server
like alterway2)
#!/bin/bash
set -x
BACKUP_DIR=/etc/backup
DAILY_BACKUPS_TO_KEEP=30
if [ ! -d $BACKUP_DIR ]
then
mkdir -p $BACKUP_DIR
fi
JENBAKLISTFILE="/tmp/jenkins-backuplistfile.$$.${RANDOM}"
pushd /var/lib/jenkins
find -maxdepth 1 -type f -name "*.xml" > $JENBAKLISTFILE
find users -type f >> $JENBAKLISTFILE
find userContent -type f >> $JENBAKLISTFILE
find plugins -type f >> $JENBAKLISTFILE
find -H jobs -maxdepth 2 -name "config.xml" -type f >> $JENBAKLISTFILE
tar czvf /etc/backup/jenkins-backup-`date +"%Y-%m-%d_%H_%M_%S"`.tgz -T
$JENBAKLISTFILE
popd
rm $JENBAKLISTFILE
find $BACKUP_DIR -type f -mtime +$DAILY_BACKUPS_TO_KEEP -exec rm '{}' \;
--
Ticket URL: <https://fedorahosted.org/ovirt/ticket/47>
ovirt <http://www.ovirt.org/>
oVirt - virtualization made easy.
More information about the Infra
mailing list