Initial checkin
This commit is contained in:
commit
f5b01d6d7a
|
@ -0,0 +1,32 @@
|
|||
# du_backups
|
||||
|
||||
# Introduction
|
||||
|
||||
This is a collection of scripts that I use to manage a duplicity based backup
|
||||
solution.
|
||||
|
||||
Configuration for the specific environment are located at the top of each
|
||||
script.
|
||||
|
||||
* du-bu
|
||||
* The main backup script
|
||||
|
||||
* du-check
|
||||
* A script to examine the previously completed backups for the current
|
||||
host only, on the destination server
|
||||
|
||||
* du-all-check
|
||||
* Similar to du-check, but checks backups from all hosts
|
||||
|
||||
* du-clean
|
||||
* A script to clean up backups from the destination server that are no
|
||||
longer required
|
||||
|
||||
* du-wrapper
|
||||
* A simple wrapper script for calling du-bu from a crontab entry. This
|
||||
script will perform a full backup on the first day of the month, and an
|
||||
incremental backup on any other day.
|
||||
|
||||
* du-list
|
||||
* A list of directories to be backed up.
|
||||
|
|
@ -0,0 +1,6 @@
|
|||
# Daily backup - full back on 1st of the month, incremental otherwise
|
||||
00 01 * * * /usr/local/bin/du-wrapper >>/usr/local/log/duplicity_cron_run.log 2>&1 &
|
||||
|
||||
# Monthly cleanup of old backups
|
||||
00 10 01 * * /usr/local/bin/du-clean >>/usr/local/log/duplicity_cron_run.log 2>&1 &
|
||||
|
|
@ -0,0 +1,26 @@
|
|||
#!/bin/bash
|
||||
|
||||
buuser="buuser"
|
||||
remhost="files.lan"
|
||||
rembase="/volumeUSB1/usbshare/rsync-backups"
|
||||
|
||||
hosts=$(ssh ${buuser}@${remhost} ls -d ${rembase}/* | cut -d'/' -f5 | grep "_backups")
|
||||
|
||||
for i in $hosts
|
||||
do
|
||||
backups=$(ssh ${buuser}@${remhost} ls -d ${rembase}/${i}/* | cut -d'/' -f6)
|
||||
for j in $backups
|
||||
do
|
||||
budst="rsync://${buuser}@${remhost}//${rembase}/${i}/${j}"
|
||||
|
||||
echo "Backup: ${i}/${j}"
|
||||
echo ">>>>>>>>>>>>>=============<<<<<<<<<<<<<"
|
||||
echo ""
|
||||
|
||||
/usr/bin/duplicity --no-encryption collection-status ${budst}
|
||||
|
||||
echo ""
|
||||
done
|
||||
cd ..
|
||||
done
|
||||
|
|
@ -0,0 +1,34 @@
|
|||
#!/bin/bash
|
||||
|
||||
bulist="/usr/local/etc/du-list"
|
||||
logdir="/usr/local/log"
|
||||
curhost=$(hostname)
|
||||
|
||||
remhost="files.lan"
|
||||
rembase="/volumeUSB1/usbshare/rsync-backups/${curhost}_backups"
|
||||
buuser="buuser"
|
||||
budst="rsync://${buuser}@${remhost}//${rembase}"
|
||||
|
||||
echo "Backup run for ${curhost} beginning at $(date +%Y%m%d-%H%M%S)" >> ${logdir}/duplicity_run.log
|
||||
|
||||
list=$(cat ${bulist})
|
||||
|
||||
for i in $list
|
||||
do
|
||||
buname=$(echo $i | sed 's/\//_/g' | sed 's/^_//g')
|
||||
bulog="${logdir}/duplicity_${buname}_$(date +%Y%m%d-%H%M%S)_run.log"
|
||||
|
||||
ssh ${buuser}@${remhost} mkdir -p ${rembase}/${buname}
|
||||
|
||||
if [ ! -z $1 ];
|
||||
then
|
||||
echo "$(date +%H%M%S): Doing full backup of ${i}" >> ${logdir}/duplicity_run.log
|
||||
/usr/bin/duplicity full --no-encryption --name ${buname} $i ${budst}/${buname} 2>&1 >> ${bulog}
|
||||
else
|
||||
echo "$(date +%H%M%S): Doing incremental backup of ${i}" >> ${logdir}/duplicity_run.log
|
||||
/usr/bin/duplicity --no-encryption --name ${buname} $i ${budst}/${buname} 2>&1 >> ${bulog}
|
||||
fi
|
||||
done
|
||||
|
||||
echo "Backup run completed at $(date +%Y%m%d-%H%M%S)" >> ${logdir}/duplicity_run.log
|
||||
|
|
@ -0,0 +1,25 @@
|
|||
#!/bin/bash
|
||||
|
||||
bulist="/usr/local/etc/du-list"
|
||||
curhost=$(hostname)
|
||||
|
||||
buuser="buuser"
|
||||
remhost="files.lan"
|
||||
rembase="/volumeUSB1/usbshare/rsync-backups/${curhost}_backups"
|
||||
budst="rsync://${buuser}@${remhost}//${rembase}"
|
||||
|
||||
buList=$(cat ${bulist})
|
||||
|
||||
for i in $buList
|
||||
do
|
||||
buname=$(echo $i | sed 's/\//_/g' | sed 's/^_//g')
|
||||
echo "Backup: ${buname}"
|
||||
echo ">>>>>>>>>>>>>=============<<<<<<<<<<<<<"
|
||||
echo ""
|
||||
|
||||
/usr/bin/duplicity --no-encryption collection-status ${budst}/${buname}
|
||||
|
||||
echo ""
|
||||
done
|
||||
|
||||
|
|
@ -0,0 +1,27 @@
|
|||
#!/bin/bash
|
||||
|
||||
bulist="/usr/local/etc/du-list"
|
||||
logdir="/usr/local/log"
|
||||
curhost=$(hostname)
|
||||
|
||||
buuser="buuser"
|
||||
remhost="files.lan"
|
||||
rembase="/volumeUSB1/usbshare/rsync-backups/${curhost}_backups"
|
||||
budst="rsync://${buuser}@${remhost}//${rembase}"
|
||||
|
||||
curDay=$(date +%d)
|
||||
|
||||
echo "Duplicity cleanup run for ${curhost} beginning at $(date +%Y%m%d-%H%M%S)" >> ${logdir}/duplicity_cleanup_run.log
|
||||
|
||||
list=$(cat ${bulist})
|
||||
|
||||
for i in $list
|
||||
do
|
||||
buname=$(echo $i | sed 's/\//_/g' | sed 's/^_//g')
|
||||
bulog="${logdir}/duplicity_${buname}_$(date +%Y%m%d-%H%M%S)_cleanup_run.log"
|
||||
|
||||
/usr/bin/duplicity remove-all-but-n-full 2 --force --no-encryption ${budst}/${buname} 2>&1 >> ${bulog}
|
||||
done
|
||||
|
||||
echo "Duplicity cleanup run completed at $(date +%Y%m%d-%H%M%S)" >> ${logdir}/duplicity_cleanup_run.log
|
||||
|
|
@ -0,0 +1,5 @@
|
|||
/etc
|
||||
/home/rmorrow
|
||||
/root
|
||||
/usr/local/bin
|
||||
/usr/local/etc
|
|
@ -0,0 +1,11 @@
|
|||
#!/bin/bash
|
||||
|
||||
curDay=$(date +%d)
|
||||
|
||||
if [[ "${curDay}" -eq "1" ]];
|
||||
then
|
||||
/usr/local/bin/du-bu full
|
||||
else
|
||||
/usr/local/bin/du-bu
|
||||
fi
|
||||
|
Loading…
Reference in New Issue