From 37fd78858db6926f6ccec465d2e84d1670b574a5 Mon Sep 17 00:00:00 2001 From: Michael Stanclift Date: Mon, 29 Jun 2020 09:21:50 -0500 Subject: [PATCH] Import last hashes --- .gitignore | 1 + gravity-sync.sh | 28 +++++++++++++++++++--------- 2 files changed, 20 insertions(+), 9 deletions(-) diff --git a/.gitignore b/.gitignore index 410ed35..4a4bd19 100644 --- a/.gitignore +++ b/.gitignore @@ -2,6 +2,7 @@ gravity-sync.log gravity-sync.cron gravity.db.last gravity-sync.conf +gravity-sync.md5 backup/*.last backup/*.backup backup/*.push diff --git a/gravity-sync.sh b/gravity-sync.sh index 4388842..efd7d2e 100755 --- a/gravity-sync.sh +++ b/gravity-sync.sh @@ -370,10 +370,20 @@ function push_gs { function smart_gs { md5_compare + last_primaryDBMD5=$(sed "1q;d" gravity-sync.md5) + last_secondDBMD5=$(sed "2q;d" gravity-sync.md5) + last_primaryCIMD5=$(sed "3q;d" gravity-sync.md5) + last_secondCIMD5=$(sed "4q;d" gravity-sync.md5) + echo -e $primaryDBMD5 echo -e $secondDBMD5 echo -e $primaryCLMD5 echo -e $secondCLMD5 + + echo -e $last_primaryDBMD5 + echo -e $last_secondDBMD5 + echo -e $last_primaryCLMD5 + echo -e $last_secondCLMD5 } function restore_gs { @@ -496,19 +506,19 @@ function restore_gs { ## Core Logging ### Write Logs Out function logs_export { + MESSAGE="Saving File Hashes" + echo_stat + rm -f gravity-sync.md5 + echo -e ${primaryDBMD5} >> gravity-sync.md5 + echo -e ${secondDBMD5} >> gravity-sync.md5 + echo -e ${primaryCLMD5} >> gravity-sync.md5 + echo -e ${secondCLMD5} >> gravity-sync.md5 + error_validate + MESSAGE="Logging Successful ${TASKTYPE}" echo_stat echo -e $(date) "[${TASKTYPE}]" >> ${LOG_PATH}/${SYNCING_LOG} error_validate - - MESSAGE="Saving File Hashes" - echo_stat - rm -f backup/gravity-sync.md5 - echo -e ${primaryDBMD5} >> backup/gravity-sync.md5 - echo -e ${secondDBMD5} >> backup/gravity-sync.md5 - echo -e ${primaryCLMD5} >> backup/gravity-sync.md5 - echo -e ${secondCLMD5} >> backup/gravity-sync.md5 - error_validate } ### Output Sync Logs