mirror of
https://github.com/pi-hole/pi-hole.git
synced 2025-04-27 01:30:18 +00:00
Store failed gravity restoration status in message table
Signed-off-by: DL6ER <dl6er@dl6er.de>
This commit is contained in:
parent
9a9af719f0
commit
633c971a44
2 changed files with 11 additions and 3 deletions
|
@ -353,12 +353,13 @@ gravity_CheckDNSResolutionAvailable() {
|
|||
# 0 - If the backup is successfully restored.
|
||||
# 1 - If no backup is available or if the restoration fails.
|
||||
try_restore_backup () {
|
||||
local num
|
||||
local num filename
|
||||
num=$1
|
||||
filename="${gravityBCKfile}.${num}"
|
||||
# Check if a backup exists
|
||||
if [ -f "${gravityBCKfile}.${num}" ]; then
|
||||
if [ -f "${filename}" ]; then
|
||||
echo -e " ${INFO} Attempting to restore previous database from backup no. ${num}"
|
||||
cp "${gravityBCKfile}.${num}" "${gravityDBfile}"
|
||||
cp "${filename}" "${gravityDBfile}"
|
||||
|
||||
# If the backup was successfully copied, prepare a new gravity database from
|
||||
# it
|
||||
|
@ -372,6 +373,7 @@ try_restore_backup () {
|
|||
gravity_Cleanup "error"
|
||||
fi
|
||||
|
||||
pihole-FTL sqlite3 "${gravityTEMPfile}" "INSERT OR REPLACE INTO info (property,value) values ('gravity_restored','${filename}');"
|
||||
echo -e " ${TICK} Successfully restored from backup (${gravityBCKfile}.${num})"
|
||||
return 0
|
||||
else
|
||||
|
@ -434,6 +436,7 @@ gravity_DownloadBlocklists() {
|
|||
# If none of the attempts worked, return 1
|
||||
if [[ "${i}" -eq 10 ]]; then
|
||||
return 1
|
||||
pihole-FTL sqlite3 "${gravityTEMPfile}" "INSERT OR REPLACE INTO info (property,value) values ('gravity_restored','failed');"
|
||||
fi
|
||||
|
||||
echo -e " ${TICK} ${str}"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue