Implemented Jim rsync

Preserve permissions and backup in one line
This commit is contained in:
Michael Stanclift 2020-05-26 12:14:32 -05:00
parent e1d2b98074
commit 143371943a

View File

@ -108,21 +108,16 @@ function pull_gs {
echo -e "${INFO} ${TASKTYPE} Commencing"
MESSAGE="Pulling ${GRAVITY_FI} from ${REMOTE_HOST}"
echo -en "${STAT} ${MESSAGE}"
${SSHPASSWORD} rsync -v -e 'ssh -p 22' ${REMOTE_USER}@${REMOTE_HOST}:${PIHOLE_DIR}/${GRAVITY_FI} $HOME/${LOCAL_FOLDR}/${BACKUP_FOLD}/${GRAVITY_FI}.pull >/dev/null 2>&1
error_validate
MESSAGE="Backing Up ${GRAVITY_FI} on $HOSTNAME"
echo -en "${STAT} ${MESSAGE}"
cp -v ${PIHOLE_DIR}/${GRAVITY_FI} $HOME/${LOCAL_FOLDR}/${BACKUP_FOLD}/${GRAVITY_FI}.backup >/dev/null 2>&1
error_validate
MESSAGE="Replacing ${GRAVITY_FI} on $HOSTNAME"
echo -en "${STAT} ${MESSAGE}"
sudo cp -v $HOME/${LOCAL_FOLDR}/${BACKUP_FOLD}/${GRAVITY_FI}.pull ${PIHOLE_DIR}/${GRAVITY_FI} >/dev/null 2>&1
MESSAGE="Pulling ${GRAVITY_FI} from ${REMOTE_HOST}"
echo -en "${STAT} ${MESSAGE}"
${SSHPASSWORD} rsync -pog -b --backup-dir=$HOME/${LOCAL_FOLDR}/${BACKUP_FOLD} --suffix=.pull -e 'ssh -p 22' ${REMOTE_USER}@${REMOTE_HOST}:${PIHOLE_DIR}/${GRAVITY_FI} ${PIHOLE_DIR} >/dev/null 2>&1
error_validate
MESSAGE="Validating Ownership on ${GRAVITY_FI}"
echo -en "${STAT} ${MESSAGE}"