#!/bin/bash
BACKUPROOT="/data/backups"
CLIENTNAME="<%= @host_name %>"
SOURCEDIR="<%= @directory %>"
# Not currently used here, probably will use it for auto-cleanup later
FREQUENCY="<%= @frequency %>"
DATE=`date +"%Y%m%d"`
logger -p local3.info -t govuk-backup Backup of $CLIENTNAME:$SOURCEDIR started
mkdir -p ${BACKUPROOT}/${CLIENTNAME}${SOURCEDIR}
rsync -qa -e "ssh -o VisualHostKey=false" --delete govuk-backup@${CLIENTNAME}:${SOURCEDIR} ${BACKUPROOT}/${CLIENTNAME}${SOURCEDIR}
echo "Date: $DATE" > ${BACKUPROOT}/${CLIENTNAME}${SOURCEDIR}/BACKUPINFO
logger -p local3.info -t govuk-backup Backup of $CLIENTNAME:$SOURCEDIR ended


#!/bin/bash
BACKUPROOT="/data/backups"
CLIENTNAME="<%= @host_name %>"
SOURCEDIR="<%= @directory %>"
# Not currently used here, probably will use it for auto-cleanup later
FREQUENCY="<%= @frequency %>"
DATE=`date +"%Y%m%d"`
logger -p local3.info -t govuk-backup Backup of $CLIENTNAME:$SOURCEDIR started
mkdir -p ${BACKUPROOT}/${CLIENTNAME}${SOURCEDIR}
rsync -qa -e "ssh -o VisualHostKey=false" --delete govuk-backup@${CLIENTNAME}:${SOURCEDIR} ${BACKUPROOT}/${CLIENTNAME}${SOURCEDIR}/
echo "Date: $DATE" > ${BACKUPROOT}/${CLIENTNAME}${SOURCEDIR}/BACKUPINFO
logger -p local3.info -t govuk-backup Backup of $CLIENTNAME:$SOURCEDIR ended


Fix the rsync command so that we do not have subdirs of the backup
Fix the rsync command so that we do not have subdirs of the backup
