From 295b237da9f733199f2114ad946c12b09a60cfba Mon Sep 17 00:00:00 2001 From: Michael Stanclift Date: Sun, 18 Jul 2021 22:09:55 -0500 Subject: [PATCH] 3.4.5 (#224) * Add the addition of an Environment Path variable in Crontab (#212) * Add detection of missing path components and addition of path to crontab * Fix bug where \n is inserted literally * Fix `find` command invoke (Issue #220) (#223) * 3.4.5 Co-authored-by: Michael Thompson <25192401+nh-mike@users.noreply.github.com> Co-authored-by: benjaminfd Co-authored-by: Michael Stanclift --- VERSION | 2 +- gravity-sync.sh | 2 +- includes/gs-automate.sh | 11 +++++++++-- includes/gs-backup.sh | 2 +- 4 files changed, 12 insertions(+), 5 deletions(-) diff --git a/VERSION b/VERSION index 5141b61..3ec370e 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -3.4.4 \ No newline at end of file +3.4.5 \ No newline at end of file diff --git a/gravity-sync.sh b/gravity-sync.sh index a0880b0..879b04a 100755 --- a/gravity-sync.sh +++ b/gravity-sync.sh @@ -3,7 +3,7 @@ SCRIPT_START=$SECONDS # GRAVITY SYNC BY VMSTAN ##################### PROGRAM='Gravity Sync' -VERSION='3.4.4' +VERSION='3.4.5' # For documentation or downloading updates visit https://github.com/vmstan/gravity-sync # Requires Pi-Hole 5.x or higher already be installed, for help visit https://pi-hole.net diff --git a/includes/gs-automate.sh b/includes/gs-automate.sh index 435d3a2..1c273cb 100644 --- a/includes/gs-automate.sh +++ b/includes/gs-automate.sh @@ -39,9 +39,16 @@ function task_automate { clear_cron fi + if [[ ${PATH} != *"/usr/sbin"* ]] + then + CRON_ENV_PATH=$'PATH=/bin:/usr/bin:/usr/sbin\n' + else + CRON_ENV_PATH="" + fi + MESSAGE="${UI_AUTO_CRON_SAVING}" echo_stat - (crontab -l 2>/dev/null; echo "*/${INPUT_AUTO_FREQ} * * * * ${BASH_PATH} ${LOCAL_FOLDR}/${GS_FILENAME} smart > ${LOG_PATH}/${CRONJOB_LOG}") | crontab - + (crontab -l 2>/dev/null; echo "${CRON_ENV_PATH}*/${INPUT_AUTO_FREQ} * * * * ${BASH_PATH} ${LOCAL_FOLDR}/${GS_FILENAME} smart > ${LOG_PATH}/${CRONJOB_LOG}") | crontab - error_validate elif [ $INPUT_AUTO_FREQ == 0 ] then @@ -84,4 +91,4 @@ function task_cron { echo_good show_crontab -} \ No newline at end of file +} diff --git a/includes/gs-backup.sh b/includes/gs-backup.sh index 8ff4d42..e1b6145 100644 --- a/includes/gs-backup.sh +++ b/includes/gs-backup.sh @@ -149,7 +149,7 @@ function backup_cleanup() { MESSAGE="${UI_BACKUP_PURGE}" echo_stat - find ${LOCAL_FOLDR}/${BACKUP_FOLD}/*.backup -mtime +${BACKUP_RETAIN} -type f -delete + find ${LOCAL_FOLDR}/${BACKUP_FOLD}/ -name "*.backup*" -mtime +${BACKUP_RETAIN} -type f -delete error_validate BACKUP_FOLDER_SIZE=$(du -h ${LOCAL_FOLDR}/${BACKUP_FOLD} | sed 's/\s.*$//')