mirror of
https://github.com/pi-hole/pi-hole.git
synced 2024-11-15 10:43:55 +00:00
Only run VACUUM on "full" gravity runs
Signed-off-by: DL6ER <dl6er@dl6er.de>
This commit is contained in:
parent
93f1859bab
commit
fc62cf7e2f
1 changed files with 16 additions and 13 deletions
29
gravity.sh
29
gravity.sh
|
@ -39,6 +39,7 @@ VPNList="/etc/openvpn/ipp.txt"
|
||||||
piholeGitDir="/etc/.pihole"
|
piholeGitDir="/etc/.pihole"
|
||||||
gravityDBfile="${piholeDir}/gravity.db"
|
gravityDBfile="${piholeDir}/gravity.db"
|
||||||
gravityDBschema="${piholeGitDir}/advanced/Templates/gravity.db.schema"
|
gravityDBschema="${piholeGitDir}/advanced/Templates/gravity.db.schema"
|
||||||
|
optimize_database=true
|
||||||
|
|
||||||
domainsExtension="domains"
|
domainsExtension="domains"
|
||||||
matterAndLight="${basename}.0.matterandlight.txt"
|
matterAndLight="${basename}.0.matterandlight.txt"
|
||||||
|
@ -685,17 +686,19 @@ gravity_Cleanup() {
|
||||||
|
|
||||||
echo -e "${OVER} ${TICK} ${str}"
|
echo -e "${OVER} ${TICK} ${str}"
|
||||||
|
|
||||||
str="Optimizing domains database"
|
if ${optimize_database} ; then
|
||||||
echo -ne " ${INFO} ${str}..."
|
str="Optimizing domains database"
|
||||||
# Store
|
echo -ne " ${INFO} ${str}..."
|
||||||
output=$( { sqlite3 "${gravityDBfile}" <<< "VACUUM;"; } 2>&1 )
|
# Store
|
||||||
status="$?"
|
output=$( { sqlite3 "${gravityDBfile}" <<< "VACUUM;"; } 2>&1 )
|
||||||
|
status="$?"
|
||||||
|
|
||||||
if [[ "${status}" -ne 0 ]]; then
|
if [[ "${status}" -ne 0 ]]; then
|
||||||
echo -e "\\n ${CROSS} Unable to optimize gravity database ${gravityDBfile}\\n ${output}"
|
echo -e "\\n ${CROSS} Unable to optimize gravity database ${gravityDBfile}\\n ${output}"
|
||||||
gravity_Cleanup "error"
|
gravity_Cleanup "error"
|
||||||
else
|
else
|
||||||
echo -e "${OVER} ${TICK} ${str}"
|
echo -e "${OVER} ${TICK} ${str}"
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Only restart DNS service if offline
|
# Only restart DNS service if offline
|
||||||
|
@ -726,9 +729,9 @@ for var in "$@"; do
|
||||||
"-f" | "--force" ) forceDelete=true;;
|
"-f" | "--force" ) forceDelete=true;;
|
||||||
"-h" | "--help" ) helpFunc;;
|
"-h" | "--help" ) helpFunc;;
|
||||||
"-sd" | "--skip-download" ) skipDownload=true;;
|
"-sd" | "--skip-download" ) skipDownload=true;;
|
||||||
"-b" | "--blacklist-only" ) listType="blacklist";;
|
"-b" | "--blacklist-only" ) listType="blacklist"; optimize_database=false;;
|
||||||
"-w" | "--whitelist-only" ) listType="whitelist";;
|
"-w" | "--whitelist-only" ) listType="whitelist"; optimize_database=false;;
|
||||||
"-wild" | "--wildcard-only" ) listType="wildcard"; dnsRestartType="restart";;
|
"-wild" | "--wildcard-only" ) listType="wildcard"; optimize_database=false; dnsRestartType="restart";;
|
||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue