From 52e547fa4f9efec5aed890e2ffe4f8e99a1b788a Mon Sep 17 00:00:00 2001 From: Michael Stanclift Date: Mon, 22 Jun 2020 09:42:04 -0500 Subject: [PATCH 01/20] 1.8.3 --- ADVANCED.md | 4 ++-- CHANGELOG.md | 3 +++ VERSION | 2 +- gravity-sync.sh | 60 ++++++++++++++++++++++++------------------------- 4 files changed, 36 insertions(+), 33 deletions(-) diff --git a/ADVANCED.md b/ADVANCED.md index 4ac0662..62dd9cd 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/v1.8.2.zip -unzip v1.8.2.zip -d gravity-sync +wget https://github.com/vmstan/gravity-sync/archive/v1.8.3.zip +unzip v1.8.3.zip -d gravity-sync cd gravity-sync ``` diff --git a/CHANGELOG.md b/CHANGELOG.md index 5f3b3b3..5525e8d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,6 +12,9 @@ There is nothing really sexy here, but a lot of changes under the covers to impr - Adds custom port specification to ssh-copy-id and dropbearkey commands during configuration generation. - Generally better error handling of configuration options. +#### 1.8.3 +- Simplified method for input of automation frequency via crontab. + #### 1.8.2 - Corrects issue where `custom.list` file would not replicate if the file didn't exist locally, and there were no other changes to replicate. [#39](https://github.com/vmstan/gravity-sync/issues/39) diff --git a/VERSION b/VERSION index 0bfbd57..fe4e75f 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -1.8.2 \ No newline at end of file +1.8.3 \ No newline at end of file diff --git a/gravity-sync.sh b/gravity-sync.sh index 20e5789..e05b9fc 100755 --- a/gravity-sync.sh +++ b/gravity-sync.sh @@ -3,7 +3,7 @@ SCRIPT_START=$SECONDS # GRAVITY SYNC BY VMSTAN ##################### PROGRAM='Gravity Sync' -VERSION='1.8.2' +VERSION='1.8.3' # 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 @@ -1171,42 +1171,42 @@ function task_automate { exit_nochange fi - MESSAGE="Set Automation Frequency Per Hour" - echo_info + # MESSAGE="Set Automation Frequency Per Hour" + # echo_info - MESSAGE="1 = Every 60 Minutes" - echo -e "++++++ ${MESSAGE}" - MESSAGE="2 = Every 30 Minutes" - echo -e "++++++ ${MESSAGE}" - MESSAGE="4 = Every 15 Minutes" - echo -e "++++++ ${MESSAGE}" - MESSAGE="6 = Every 10 Minutes" - echo -e "++++++ ${MESSAGE}" - MESSAGE="12 = Every 05 Minutes" - echo -e "++++++ ${MESSAGE}" + # MESSAGE="1 = Every 60 Minutes" + # echo -e "++++++ ${MESSAGE}" + # MESSAGE="2 = Every 30 Minutes" + # echo -e "++++++ ${MESSAGE}" + # MESSAGE="4 = Every 15 Minutes" + # echo -e "++++++ ${MESSAGE}" + # MESSAGE="6 = Every 10 Minutes" + # echo -e "++++++ ${MESSAGE}" + # MESSAGE="12 = Every 05 Minutes" + # echo -e "++++++ ${MESSAGE}" - MESSAGE="Input Automation Frequency" + MESSAGE="Sync Frequency in Minutes (60 max)" echo_need read INPUT_AUTO_FREQ - if [ $INPUT_AUTO_FREQ == 1 ] + if [ $INPUT_AUTO_FREQ > 60 ] + # then + # AUTO_FREQ='60' + # elif [ $INPUT_AUTO_FREQ == 2 ] + # then + # AUTO_FREQ='30' + # elif [ $INPUT_AUTO_FREQ == 4 ] + # then + # AUTO_FREQ='15' + # elif [ $INPUT_AUTO_FREQ == 6 ] + # then + # AUTO_FREQ='10' + # elif [ $INPUT_AUTO_FREQ == 12 ] + # then + # AUTO_FREQ='5' then - AUTO_FREQ='60' - elif [ $INPUT_AUTO_FREQ == 2 ] - then - AUTO_FREQ='30' - elif [ $INPUT_AUTO_FREQ == 4 ] - then - AUTO_FREQ='15' - elif [ $INPUT_AUTO_FREQ == 6 ] - then - AUTO_FREQ='10' - elif [ $INPUT_AUTO_FREQ == 12 ] - then - AUTO_FREQ='5' - else MESSAGE="Invalid Input" - echo -e "${FAIL} ${MESSAGE}" + echo_fail exit_nochange fi From d434485b2c5c88725176703f60401e30d817cad7 Mon Sep 17 00:00:00 2001 From: Michael Stanclift Date: Mon, 22 Jun 2020 09:45:35 -0500 Subject: [PATCH 02/20] Add dev version output --- gravity-sync.sh | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/gravity-sync.sh b/gravity-sync.sh index e05b9fc..09d7fc9 100755 --- a/gravity-sync.sh +++ b/gravity-sync.sh @@ -1132,8 +1132,15 @@ function show_version { MESSAGE="${BLUE}https://github.com/vmstan/gravity-sync${NC}" echo_info + + if [ -f $HOME/${LOCAL_FOLDR}/dev ] + then + DEVVERSION="dev" + else + DEVVERSION="" + fi - MESSAGE="Running Version: ${GREEN}${VERSION}${NC}" + MESSAGE="Running Version: ${GREEN}${VERSION}${NC} ${DEVVERSION}" echo_info GITVERSION=$(curl -sf https://raw.githubusercontent.com/vmstan/gravity-sync/master/VERSION) From e1a36d30dc86a651e783c0c5385d7b951b5049c5 Mon Sep 17 00:00:00 2001 From: Michael Stanclift Date: Mon, 22 Jun 2020 09:46:01 -0500 Subject: [PATCH 03/20] Dev version --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 5525e8d..0b85d2e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,6 +14,7 @@ There is nothing really sexy here, but a lot of changes under the covers to impr #### 1.8.3 - Simplified method for input of automation frequency via crontab. +- Adds dev tag to version output. #### 1.8.2 - Corrects issue where `custom.list` file would not replicate if the file didn't exist locally, and there were no other changes to replicate. [#39](https://github.com/vmstan/gravity-sync/issues/39) From d2f14f63c35c51a172924eed3f9a5ef841980765 Mon Sep 17 00:00:00 2001 From: Michael Stanclift Date: Mon, 22 Jun 2020 09:52:03 -0500 Subject: [PATCH 04/20] -gt --- gravity-sync.sh | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/gravity-sync.sh b/gravity-sync.sh index 09d7fc9..e630ce2 100755 --- a/gravity-sync.sh +++ b/gravity-sync.sh @@ -1196,7 +1196,7 @@ function task_automate { echo_need read INPUT_AUTO_FREQ - if [ $INPUT_AUTO_FREQ > 60 ] + if [ $INPUT_AUTO_FREQ -gt 60 ] # then # AUTO_FREQ='60' # elif [ $INPUT_AUTO_FREQ == 2 ] @@ -1215,14 +1215,13 @@ function task_automate { MESSAGE="Invalid Input" echo_fail exit_nochange - fi - - MESSAGE="Saving to Crontab" - echo_stat + else + MESSAGE="Saving to Crontab" + echo_stat (crontab -l 2>/dev/null; echo "*/${AUTO_FREQ} * * * * ${BASH_PATH} $HOME/${LOCAL_FOLDR}/${GS_FILENAME} pull > ${LOG_PATH}/${CRONJOB_LOG}") | crontab - error_validate - - exit_withchange + exit_withchange + fi } ## Configure Task From 2915a8c49e98bb8f440c3ae2c3099eaa7ead451c Mon Sep 17 00:00:00 2001 From: Michael Stanclift Date: Mon, 22 Jun 2020 09:54:29 -0500 Subject: [PATCH 05/20] input --- gravity-sync.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gravity-sync.sh b/gravity-sync.sh index e630ce2..42c35a4 100755 --- a/gravity-sync.sh +++ b/gravity-sync.sh @@ -1218,7 +1218,7 @@ function task_automate { else MESSAGE="Saving to Crontab" echo_stat - (crontab -l 2>/dev/null; echo "*/${AUTO_FREQ} * * * * ${BASH_PATH} $HOME/${LOCAL_FOLDR}/${GS_FILENAME} pull > ${LOG_PATH}/${CRONJOB_LOG}") | crontab - + (crontab -l 2>/dev/null; echo "*/${INPUT_AUTO_FREQ} * * * * ${BASH_PATH} $HOME/${LOCAL_FOLDR}/${GS_FILENAME} pull > ${LOG_PATH}/${CRONJOB_LOG}") | crontab - error_validate exit_withchange fi From dd379e7ae5d7870bba4cf396ae05178cc20057fe Mon Sep 17 00:00:00 2001 From: Michael Stanclift Date: Mon, 22 Jun 2020 10:04:48 -0500 Subject: [PATCH 06/20] Remove existing cron --- gravity-sync.sh | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/gravity-sync.sh b/gravity-sync.sh index 42c35a4..ec9510c 100755 --- a/gravity-sync.sh +++ b/gravity-sync.sh @@ -1173,9 +1173,10 @@ function task_automate { then MESSAGE="Automation Task Already Exists" echo_info - MESSAGE="Use 'crontab -e' to manually remove/edit" - echo_info - exit_nochange + CRON_EXIST="1" + # MESSAGE="Use 'crontab -e' to manually remove/edit" + # echo_info + # exit_nochange fi # MESSAGE="Set Automation Frequency Per Hour" @@ -1216,7 +1217,18 @@ function task_automate { echo_fail exit_nochange else - MESSAGE="Saving to Crontab" + if [ CRON_EXIST == 1 ] + then + MESSAGE="Removing Existing Automation" + echo_stat + + crontab -l >$CRON_TEMP + awk '$0!~/pull/ { print $0 }' $CRON_TEMP >$CRON_NEW + crontab $CRON_NEW 2>/dev/null + error_validate + fi + + MESSAGE="Saving New Automation" echo_stat (crontab -l 2>/dev/null; echo "*/${INPUT_AUTO_FREQ} * * * * ${BASH_PATH} $HOME/${LOCAL_FOLDR}/${GS_FILENAME} pull > ${LOG_PATH}/${CRONJOB_LOG}") | crontab - error_validate From d7c6b62271401adf3f14a9a4c4f41267812b019c Mon Sep 17 00:00:00 2001 From: Michael Stanclift Date: Mon, 22 Jun 2020 10:10:24 -0500 Subject: [PATCH 07/20] 1-30 --- CHANGELOG.md | 1 + gravity-sync.sh | 8 ++++++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0b85d2e..8996009 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,6 +14,7 @@ There is nothing really sexy here, but a lot of changes under the covers to impr #### 1.8.3 - Simplified method for input of automation frequency via crontab. +- Removes existing automation task from crontab, if it exists. - Adds dev tag to version output. #### 1.8.2 diff --git a/gravity-sync.sh b/gravity-sync.sh index ec9510c..2e52d39 100755 --- a/gravity-sync.sh +++ b/gravity-sync.sh @@ -1193,11 +1193,11 @@ function task_automate { # MESSAGE="12 = Every 05 Minutes" # echo -e "++++++ ${MESSAGE}" - MESSAGE="Sync Frequency in Minutes (60 max)" + MESSAGE="Sync Frequency in Minutes (1-30)" echo_need read INPUT_AUTO_FREQ - if [ $INPUT_AUTO_FREQ -gt 60 ] + if [ $INPUT_AUTO_FREQ -gt 30 ] # then # AUTO_FREQ='60' # elif [ $INPUT_AUTO_FREQ == 2 ] @@ -1216,6 +1216,10 @@ function task_automate { MESSAGE="Invalid Input" echo_fail exit_nochange + elif [ $INPUT_AUTO_FREQ -lt 1 ] + MESSAGE="Invalid Input" + echo_fail + exit_nochange else if [ CRON_EXIST == 1 ] then From 3179d315126ebb2c8cbd526d351310934d03dec2 Mon Sep 17 00:00:00 2001 From: Michael Stanclift Date: Mon, 22 Jun 2020 10:14:01 -0500 Subject: [PATCH 08/20] sed --- gravity-sync.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gravity-sync.sh b/gravity-sync.sh index 2e52d39..c02f848 100755 --- a/gravity-sync.sh +++ b/gravity-sync.sh @@ -1227,7 +1227,7 @@ function task_automate { echo_stat crontab -l >$CRON_TEMP - awk '$0!~/pull/ { print $0 }' $CRON_TEMP >$CRON_NEW + sed '/pull/d' $CRON_TEMP >$CRON_NEW crontab $CRON_NEW 2>/dev/null error_validate fi From cacedf20fa744d1339ce308c58e9a3302dab059b Mon Sep 17 00:00:00 2001 From: Michael Stanclift Date: Mon, 22 Jun 2020 10:14:49 -0500 Subject: [PATCH 09/20] then --- gravity-sync.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/gravity-sync.sh b/gravity-sync.sh index c02f848..80869b7 100755 --- a/gravity-sync.sh +++ b/gravity-sync.sh @@ -1217,6 +1217,7 @@ function task_automate { echo_fail exit_nochange elif [ $INPUT_AUTO_FREQ -lt 1 ] + then MESSAGE="Invalid Input" echo_fail exit_nochange From d20e22bb68151c9abf88252076c7e8db02e310b3 Mon Sep 17 00:00:00 2001 From: Michael Stanclift Date: Mon, 22 Jun 2020 10:16:44 -0500 Subject: [PATCH 10/20] cron exist --- gravity-sync.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gravity-sync.sh b/gravity-sync.sh index 80869b7..7b2e5dd 100755 --- a/gravity-sync.sh +++ b/gravity-sync.sh @@ -1222,7 +1222,7 @@ function task_automate { echo_fail exit_nochange else - if [ CRON_EXIST == 1 ] + if [ $CRON_EXIST == 1 ] then MESSAGE="Removing Existing Automation" echo_stat From f7eeb41d972b91cb713773329b685d91616d1aa3 Mon Sep 17 00:00:00 2001 From: Michael Stanclift Date: Mon, 22 Jun 2020 10:17:28 -0500 Subject: [PATCH 11/20] space? --- gravity-sync.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/gravity-sync.sh b/gravity-sync.sh index 7b2e5dd..0a4e3eb 100755 --- a/gravity-sync.sh +++ b/gravity-sync.sh @@ -1227,8 +1227,8 @@ function task_automate { MESSAGE="Removing Existing Automation" echo_stat - crontab -l >$CRON_TEMP - sed '/pull/d' $CRON_TEMP >$CRON_NEW + crontab -l > $CRON_TEMP + sed '/pull/d' $CRON_TEMP > $CRON_NEW crontab $CRON_NEW 2>/dev/null error_validate fi From 45fba8428f16f6b86c9714e99be5b0091b6c70fe Mon Sep 17 00:00:00 2001 From: Michael Stanclift Date: Mon, 22 Jun 2020 10:19:54 -0500 Subject: [PATCH 12/20] out to files --- gravity-sync.sh | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/gravity-sync.sh b/gravity-sync.sh index 0a4e3eb..eebc5d9 100755 --- a/gravity-sync.sh +++ b/gravity-sync.sh @@ -1227,10 +1227,12 @@ function task_automate { MESSAGE="Removing Existing Automation" echo_stat - crontab -l > $CRON_TEMP - sed '/pull/d' $CRON_TEMP > $CRON_NEW - crontab $CRON_NEW 2>/dev/null + crontab -l > cronjob-old.tmp + sed '/pull/d' cronjob-old.tmp > cronjob-new.tmp + crontab cronjob-new.tmp 2>/dev/null error_validate + rm cronjob-old.tmp + rm cronjob-new.tmp fi MESSAGE="Saving New Automation" From c0e4880467572bac9d542648a4fc912640790089 Mon Sep 17 00:00:00 2001 From: Michael Stanclift Date: Mon, 22 Jun 2020 10:20:38 -0500 Subject: [PATCH 13/20] more specific --- gravity-sync.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gravity-sync.sh b/gravity-sync.sh index eebc5d9..59d6643 100755 --- a/gravity-sync.sh +++ b/gravity-sync.sh @@ -1228,7 +1228,7 @@ function task_automate { echo_stat crontab -l > cronjob-old.tmp - sed '/pull/d' cronjob-old.tmp > cronjob-new.tmp + sed '/.sh pull/d' cronjob-old.tmp > cronjob-new.tmp crontab cronjob-new.tmp 2>/dev/null error_validate rm cronjob-old.tmp From e27a93905a4e514852bdd46524fee75a3c9810c2 Mon Sep 17 00:00:00 2001 From: Michael Stanclift Date: Mon, 22 Jun 2020 10:27:30 -0500 Subject: [PATCH 14/20] comments --- gravity-sync.sh | 72 +++++++++++++++++++------------------------------ 1 file changed, 27 insertions(+), 45 deletions(-) diff --git a/gravity-sync.sh b/gravity-sync.sh index 59d6643..397ec80 100755 --- a/gravity-sync.sh +++ b/gravity-sync.sh @@ -1174,75 +1174,57 @@ function task_automate { MESSAGE="Automation Task Already Exists" echo_info CRON_EXIST="1" - # MESSAGE="Use 'crontab -e' to manually remove/edit" - # echo_info - # exit_nochange fi - - # MESSAGE="Set Automation Frequency Per Hour" - # echo_info - - # MESSAGE="1 = Every 60 Minutes" - # echo -e "++++++ ${MESSAGE}" - # MESSAGE="2 = Every 30 Minutes" - # echo -e "++++++ ${MESSAGE}" - # MESSAGE="4 = Every 15 Minutes" - # echo -e "++++++ ${MESSAGE}" - # MESSAGE="6 = Every 10 Minutes" - # echo -e "++++++ ${MESSAGE}" - # MESSAGE="12 = Every 05 Minutes" - # echo -e "++++++ ${MESSAGE}" - MESSAGE="Sync Frequency in Minutes (1-30)" + MESSAGE="Sync Frequency in Minutes (0-30)" echo_need read INPUT_AUTO_FREQ if [ $INPUT_AUTO_FREQ -gt 30 ] - # then - # AUTO_FREQ='60' - # elif [ $INPUT_AUTO_FREQ == 2 ] - # then - # AUTO_FREQ='30' - # elif [ $INPUT_AUTO_FREQ == 4 ] - # then - # AUTO_FREQ='15' - # elif [ $INPUT_AUTO_FREQ == 6 ] - # then - # AUTO_FREQ='10' - # elif [ $INPUT_AUTO_FREQ == 12 ] - # then - # AUTO_FREQ='5' then MESSAGE="Invalid Input" echo_fail exit_nochange elif [ $INPUT_AUTO_FREQ -lt 1 ] then - MESSAGE="Invalid Input" - echo_fail - exit_nochange + if [ $CRON_EXIST == 1 ] + then + clear_cron + + MESSAGE="Automation Disabled" + echo_info + else + MESSAGE="Invalid Input" + echo_stat + exit_nochange + fi else if [ $CRON_EXIST == 1 ] then - MESSAGE="Removing Existing Automation" - echo_stat - - crontab -l > cronjob-old.tmp - sed '/.sh pull/d' cronjob-old.tmp > cronjob-new.tmp - crontab cronjob-new.tmp 2>/dev/null - error_validate - rm cronjob-old.tmp - rm cronjob-new.tmp + clear_cron fi MESSAGE="Saving New Automation" echo_stat (crontab -l 2>/dev/null; echo "*/${INPUT_AUTO_FREQ} * * * * ${BASH_PATH} $HOME/${LOCAL_FOLDR}/${GS_FILENAME} pull > ${LOG_PATH}/${CRONJOB_LOG}") | crontab - error_validate - exit_withchange fi + exit_withchange } +## Clear Existing Automation Settings +function clear_cron { + MESSAGE="Removing Existing Automation" + echo_stat + + crontab -l > cronjob-old.tmp + sed '/.sh pull/d' cronjob-old.tmp > cronjob-new.tmp + crontab cronjob-new.tmp 2>/dev/null + error_validate + rm cronjob-old.tmp + rm cronjob-new.tmp +} + ## Configure Task function task_configure { TASKTYPE='CONFIGURE' From 5bb0a1012ab024fa42c4f8668b6234d72a86a42c Mon Sep 17 00:00:00 2001 From: Michael Stanclift Date: Mon, 22 Jun 2020 10:30:49 -0500 Subject: [PATCH 15/20] Cronexist=0 --- gravity-sync.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/gravity-sync.sh b/gravity-sync.sh index 397ec80..b7160d3 100755 --- a/gravity-sync.sh +++ b/gravity-sync.sh @@ -1168,12 +1168,13 @@ function task_automate { import_gs + CRON_EXIST='0' CRON_CHECK=$(crontab -l | grep -q "${GS_FILENAME}" && echo '1' || echo '0') if [ ${CRON_CHECK} == 1 ] then MESSAGE="Automation Task Already Exists" echo_info - CRON_EXIST="1" + CRON_EXIST='1' fi MESSAGE="Sync Frequency in Minutes (0-30)" From 016dc64cf2b8172ceb1338e3ff36a84df676ddd9 Mon Sep 17 00:00:00 2001 From: Michael Stanclift Date: Mon, 22 Jun 2020 10:32:45 -0500 Subject: [PATCH 16/20] skip the checks --- gravity-sync.sh | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/gravity-sync.sh b/gravity-sync.sh index b7160d3..609cb2f 100755 --- a/gravity-sync.sh +++ b/gravity-sync.sh @@ -1188,17 +1188,17 @@ function task_automate { exit_nochange elif [ $INPUT_AUTO_FREQ -lt 1 ] then - if [ $CRON_EXIST == 1 ] - then + #if [ $CRON_EXIST == 1 ] + #then clear_cron MESSAGE="Automation Disabled" echo_info - else - MESSAGE="Invalid Input" - echo_stat - exit_nochange - fi + #else + # MESSAGE="No Automation Scheduled" + # echo_info + # exit_nochange + #fi else if [ $CRON_EXIST == 1 ] then From 459c714f2d9dffa2e8cf34aff5f2af449f1c2106 Mon Sep 17 00:00:00 2001 From: Michael Stanclift Date: Mon, 22 Jun 2020 10:33:24 -0500 Subject: [PATCH 17/20] nevermind --- gravity-sync.sh | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/gravity-sync.sh b/gravity-sync.sh index 609cb2f..8465b45 100755 --- a/gravity-sync.sh +++ b/gravity-sync.sh @@ -1188,17 +1188,17 @@ function task_automate { exit_nochange elif [ $INPUT_AUTO_FREQ -lt 1 ] then - #if [ $CRON_EXIST == 1 ] - #then + if [ $CRON_EXIST == 1 ] + then clear_cron MESSAGE="Automation Disabled" echo_info - #else - # MESSAGE="No Automation Scheduled" - # echo_info - # exit_nochange - #fi + else + MESSAGE="No Automation Scheduled" + echo_info + exit_nochange + fi else if [ $CRON_EXIST == 1 ] then From 33d71dc7c8a7ddd7bcd3d48c4dba59d2363db0c6 Mon Sep 17 00:00:00 2001 From: Michael Stanclift Date: Mon, 22 Jun 2020 10:34:20 -0500 Subject: [PATCH 18/20] range --- gravity-sync.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gravity-sync.sh b/gravity-sync.sh index 8465b45..f01f26a 100755 --- a/gravity-sync.sh +++ b/gravity-sync.sh @@ -1183,7 +1183,7 @@ function task_automate { if [ $INPUT_AUTO_FREQ -gt 30 ] then - MESSAGE="Invalid Input" + MESSAGE="Invalid Frequency Range" echo_fail exit_nochange elif [ $INPUT_AUTO_FREQ -lt 1 ] From 2842eea71e0f4a1cd67b3476da009cd1308e2989 Mon Sep 17 00:00:00 2001 From: Michael Stanclift Date: Mon, 22 Jun 2020 10:35:42 -0500 Subject: [PATCH 19/20] 0 to disable --- CHANGELOG.md | 1 + gravity-sync.sh | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8996009..a40eba4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -15,6 +15,7 @@ There is nothing really sexy here, but a lot of changes under the covers to impr #### 1.8.3 - Simplified method for input of automation frequency via crontab. - Removes existing automation task from crontab, if it exists. +- Automation can be disabled by setting frequency to 0 when prompted. - Adds dev tag to version output. #### 1.8.2 diff --git a/gravity-sync.sh b/gravity-sync.sh index f01f26a..17ef29d 100755 --- a/gravity-sync.sh +++ b/gravity-sync.sh @@ -1177,7 +1177,7 @@ function task_automate { CRON_EXIST='1' fi - MESSAGE="Sync Frequency in Minutes (0-30)" + MESSAGE="Sync Frequency in Minutes (1-30) or 0 to Disable" echo_need read INPUT_AUTO_FREQ From ef635627baf98331a1c1137f947e6ffc9ddf024e Mon Sep 17 00:00:00 2001 From: Michael Stanclift Date: Mon, 22 Jun 2020 11:21:40 -0500 Subject: [PATCH 20/20] 1.8.3 (1) --- CHANGELOG.md | 8 ++++---- README.md | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index a40eba4..4db75da 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,10 +13,10 @@ There is nothing really sexy here, but a lot of changes under the covers to impr - Generally better error handling of configuration options. #### 1.8.3 -- Simplified method for input of automation frequency via crontab. -- Removes existing automation task from crontab, if it exists. -- Automation can be disabled by setting frequency to 0 when prompted. -- Adds dev tag to version output. +- Simplified method for input of automation frequency when running `./gravity-sync.sh automate` function. +- Now removes existing automation task from crontab, if it exists, when re-running `automate` function. +- Automation can be disabled by setting frequency to `0` when prompted. +- Adds `dev` tag to `./gravity-sync.sh version` output for users running off the development branch. #### 1.8.2 - Corrects issue where `custom.list` file would not replicate if the file didn't exist locally, and there were no other changes to replicate. [#39](https://github.com/vmstan/gravity-sync/issues/39) diff --git a/README.md b/README.md index 4078711..df7245a 100644 --- a/README.md +++ b/README.md @@ -122,7 +122,7 @@ Automation of sync is accomplished by adding an execution of the script to the u ./gravity-sync.sh automate ``` -Select the frequency per hour that you'd like to sync (once, twice, quadrice, etc) and that's it. +Select the frequency per hour (in minutes) that you'd like to sync and that's it. Now, make another small adjustment to your primary settings and wait until annointed time to see if your changes have been synchronized. If so, profit! If not, start from the beginning. From this point forward any blocklist changes you make to the primary will reflect on the secondary within the frequency you select. @@ -135,7 +135,7 @@ If you'd like to see the log of what was run the last crontab, you can view that Keep in mind if your cron task has never run, you will not see any valid output from this command. ### Adjusting Automation -You can verify your cron entry by running `crontab -l` and see it listed at the bottom of the file. If you decide to remove or change your frequency, you'll need to run `crontab -e` and adjust this by hand. If you're unsure of how to adjust the timers by hand, just delete the entire line in the crontab file and then re-run the `./gravity-sync automate` function. +You can verify your existing automation entry by running `crontab -l` and see it listed at the bottom of the crontab file. If you decide to remove or change your frequency (as of version 1.8.3) you can run `./gravity-sync.sh automate` again and pick a new timing, including setting it to 0 to disable automation. ## Advanced Installation Please review the [Advanced Installation](https://github.com/vmstan/gravity-sync/blob/master/ADVANCED.md) guide for assistance.