From 087550742a0b387a30bf87cce8cc118101a3f44b Mon Sep 17 00:00:00 2001 From: Michael Stanclift Date: Mon, 28 Mar 2022 14:18:16 -0500 Subject: [PATCH] 3.6.3 (#313) * remove full dns restart * change conditions for ftl restart * run reload for non-smart tasks * 3.6.3 * add user path to crontab * "" * include path * $ * PATH=$PATH * add Path_Fix --- VERSION | 2 +- gravity-sync.sh | 2 +- includes/gs-automate.sh | 18 ++++++++++-------- includes/gs-pull.sh | 19 +++++++++++++++---- includes/gs-push.sh | 22 +++++++++++++++++----- 5 files changed, 44 insertions(+), 19 deletions(-) diff --git a/VERSION b/VERSION index 77a069e..1ac53bb 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -3.6.2 \ No newline at end of file +3.6.3 \ No newline at end of file diff --git a/gravity-sync.sh b/gravity-sync.sh index 855d0d6..86644f7 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.6.2' +VERSION='3.6.3' # 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 ebfb1f1..0259c93 100644 --- a/includes/gs-automate.sh +++ b/includes/gs-automate.sh @@ -38,17 +38,12 @@ function task_automate { then clear_cron fi - - if [[ ${PATH} != *"/usr/sbin"* ]] - then - CRON_ENV_PATH=$'PATH=/bin:/usr/bin:/usr/sbin\n' - else - CRON_ENV_PATH="" - fi + + path_fix MESSAGE="${UI_AUTO_CRON_SAVING}" echo_stat - (crontab -l 2>/dev/null; echo "${CRON_ENV_PATH}*/${INPUT_AUTO_FREQ} * * * * ${BASH_PATH} ${LOCAL_FOLDR}/${GS_FILENAME} smart > ${LOG_PATH}/${CRONJOB_LOG}") | crontab - + (crontab -l 2>/dev/null; echo "*/${INPUT_AUTO_FREQ} * * * * ${BASH_PATH} ${LOCAL_FOLDR}/${GS_FILENAME} smart > ${LOG_PATH}/${CRONJOB_LOG}") | crontab - error_validate elif [ $INPUT_AUTO_FREQ == 0 ] then @@ -89,3 +84,10 @@ function task_cron { show_crontab } + +function path_fix { + MESSAGE="Adding user path to Crontab" + echo_stat + (crontab -l 2>/dev/null; echo "PATH=$PATH") | crontab - + error_validate +} \ No newline at end of file diff --git a/includes/gs-pull.sh b/includes/gs-pull.sh index bdd14b6..f423bab 100644 --- a/includes/gs-pull.sh +++ b/includes/gs-pull.sh @@ -111,10 +111,21 @@ function pull_gs_reload { ${PH_EXEC} restartdns reload-lists >/dev/null 2>&1 error_validate - MESSAGE="${UI_FTLDNS_CONFIG_RELOAD}" - echo_stat - ${PH_EXEC} restartdns >/dev/null 2>&1 - error_validate + if [ "${TASKTYPE}" == SMART ] + then + if [ "${PRICLCHANGE}" == "1" ] || [ "${SECCLCHANGE}" == "1" ] || [ "${PRICNCHANGE}" == "1" ] || [ "${SECCNCHANGE}" == "1" ] + then + MESSAGE="${UI_FTLDNS_CONFIG_RELOAD}" + echo_stat + ${PH_EXEC} restartdns >/dev/null 2>&1 + error_validate + fi + else + MESSAGE="${UI_FTLDNS_CONFIG_RELOAD}" + echo_stat + ${PH_EXEC} restartdns >/dev/null 2>&1 + error_validate + fi } ## Pull Function diff --git a/includes/gs-push.sh b/includes/gs-push.sh index fa46dd6..58ffb2a 100644 --- a/includes/gs-push.sh +++ b/includes/gs-push.sh @@ -148,11 +148,23 @@ function push_gs_reload { CMD_REQUESTED="${RH_EXEC} restartdns reload-lists" create_sshcmd - MESSAGE="${UI_FTLDNS_CONFIG_PUSH_RELOAD}" - echo_stat - CMD_TIMEOUT=$BACKUP_TIMEOUT - CMD_REQUESTED="${RH_EXEC} restartdns" - create_sshcmd + if [ "${TASKTYPE}" == SMART ] + then + if [ "${PRICLCHANGE}" == "1" ] || [ "${SECCLCHANGE}" == "1" ] || [ "${PRICNCHANGE}" == "1" ] || [ "${SECCNCHANGE}" == "1" ] + then + MESSAGE="${UI_FTLDNS_CONFIG_PUSH_RELOAD}" + echo_stat + CMD_TIMEOUT=$BACKUP_TIMEOUT + CMD_REQUESTED="${RH_EXEC} restartdns" + create_sshcmd + fi + else + MESSAGE="${UI_FTLDNS_CONFIG_PUSH_RELOAD}" + echo_stat + CMD_TIMEOUT=$BACKUP_TIMEOUT + CMD_REQUESTED="${RH_EXEC} restartdns" + create_sshcmd + fi } ## Push Function