diff --git a/ADVANCED.md b/ADVANCED.md index 0e46f01..3c63b5a 100644 --- a/ADVANCED.md +++ b/ADVANCED.md @@ -14,8 +14,8 @@ Download the latest release from [GitHub](https://github.com/vmstan/gravity-sync ```bash cd ~ -wget https://github.com/vmstan/gravity-sync/archive/v2.1.2.zip -unzip v2.1.2.zip -d gravity-sync +wget https://github.com/vmstan/gravity-sync/archive/v2.1.5.zip +unzip v2.1.5.zip -d gravity-sync cd gravity-sync ``` diff --git a/CHANGELOG.md b/CHANGELOG.md index 2a10d90..7a813c6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -25,6 +25,9 @@ The `./gravity-sync.sh update` and `version` functions will look for the `dbclie #### 2.1.2 - Corrects a bug in `backup` automation that causes the backup to run every minute during the hour selected. +#### 2.1.5 +Skipping a few digits because what does it really matter? + ## 2.0 ### The Smart Release diff --git a/VERSION b/VERSION index 8f9174b..c5864dc 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -2.1.2 \ No newline at end of file +2.1.5 \ No newline at end of file diff --git a/gravity-sync.sh b/gravity-sync.sh index b0980ea..ea27732 100755 --- a/gravity-sync.sh +++ b/gravity-sync.sh @@ -3,7 +3,7 @@ SCRIPT_START=$SECONDS # GRAVITY SYNC BY VMSTAN ##################### PROGRAM='Gravity Sync' -VERSION='2.1.2' +VERSION='2.1.5' # Execute from the home folder of the user who owns it (ex: 'cd ~/gravity-sync') # For documentation or downloading updates visit https://github.com/vmstan/gravity-sync @@ -141,10 +141,13 @@ function update_gs { # Gravity Core Functions ## Pull Gravity function pull_gs_grav { - MESSAGE="Backing Up ${GRAVITY_FI} on $HOSTNAME" - echo_stat - cp ${PIHOLE_DIR}/${GRAVITY_FI} $HOME/${LOCAL_FOLDR}/${BACKUP_FOLD}/${GRAVITY_FI}.backup >/dev/null 2>&1 - error_validate + + backup_local_gravity + + # MESSAGE="Backing Up ${GRAVITY_FI} on $HOSTNAME" + # echo_stat + # cp ${PIHOLE_DIR}/${GRAVITY_FI} $HOME/${LOCAL_FOLDR}/${BACKUP_FOLD}/${GRAVITY_FI}.backup >/dev/null 2>&1 + # error_validate MESSAGE="Pulling ${GRAVITY_FI} from ${REMOTE_HOST}" echo_stat @@ -291,6 +294,7 @@ function pull_gs_reload { function pull_gs { md5_compare + backup_settime pull_gs_grav pull_gs_cust pull_gs_reload @@ -1693,14 +1697,27 @@ function task_backup { MESSAGE="${MESSAGE}: ${TASKTYPE} Requested" echo_good - BACKUPTIMESTAMP=$(date +%F-%H%M%S) + backup_settime + backup_local_gravity + backup_local_custom + backup_cleanup + + exit_withchange +} +function backup_settime { + BACKUPTIMESTAMP=$(date +%F-%H%M%S) +} + +function backup_local_gravity { MESSAGE="Performing Backup of ${GRAVITY_FI}" echo_stat sqlite3 ${PIHOLE_DIR}/${GRAVITY_FI} ".backup '$HOME/${LOCAL_FOLDR}/${BACKUP_FOLD}/${BACKUPTIMESTAMP}-${GRAVITY_FI}.backup'" error_validate +} +function backup_local_custom { if [ "$SKIP_CUSTOM" != '1' ] then if [ -f ${PIHOLE_DIR}/${CUSTOM_DNS} ] @@ -1712,14 +1729,14 @@ function task_backup { error_validate fi fi +} +function backup_cleanup { MESSAGE="Cleaning Up Old Backups" echo_stat find $HOME/${LOCAL_FOLDR}/${BACKUP_FOLD}/$(date +%Y)*.backup -mtime +${BACKUP_RETAIN} -type f -delete error_validate - - exit_withchange } # Echo Stack