diff --git a/gravity.sh b/gravity.sh index 6c3e9ec6..a228644c 100755 --- a/gravity.sh +++ b/gravity.sh @@ -181,6 +181,7 @@ gravity_Supernova() { echo "" fi done + gravity_Blackbody=true } # Download specified URL and perform checks on HTTP status and file content @@ -554,14 +555,17 @@ gravity_Cleanup() { rm ${piholeDir}/*.tmp 2> /dev/null rm /tmp/*.phgpb 2> /dev/null - # Remove any unused .domains files - for file in ${piholeDir}/*.${domainsExtension}; do - # If list is not in active array, then remove it - if [[ ! "${activeDomains[*]}" == *"${file}"* ]]; then - rm -f "${file}" 2> /dev/null || \ - echo -e " ${CROSS} Failed to remove ${file##*/}" - fi - done + # Ensure this function only runs when gravity_Supernova() has completed + if [[ "${gravity_Blackbody:-}" == true ]]; then + # Remove any unused .domains files + for file in ${piholeDir}/*.${domainsExtension}; do + # If list is not in active array, then remove it + if [[ ! "${activeDomains[*]}" == *"${file}"* ]]; then + rm -f "${file}" 2> /dev/null || \ + echo -e " ${CROSS} Failed to remove ${file##*/}" + fi + done + fi echo -e "${OVER} ${TICK} ${str}"