mirror of
https://github.com/pi-hole/pi-hole.git
synced 2024-12-25 06:10:20 +00:00
Merge pull request #2903 from pi-hole/tweak/store-gravity-timestamp
Store timestamp when the gravity table was last updated successfully
This commit is contained in:
commit
ab90ff565a
1 changed files with 12 additions and 0 deletions
12
gravity.sh
12
gravity.sh
|
@ -90,6 +90,16 @@ generate_gravity_database() {
|
|||
chmod g+w "${piholeDir}" "${gravityDBfile}"
|
||||
}
|
||||
|
||||
update_gravity_timestamp() {
|
||||
# Update timestamp when the gravity table was last updated successfully
|
||||
output=$( { sqlite3 "${gravityDBfile}" <<< "INSERT OR REPLACE INTO info (property,value) values (\"updated\",cast(strftime('%s', 'now') as int));"; } 2>&1 )
|
||||
status="$?"
|
||||
|
||||
if [[ "${status}" -ne 0 ]]; then
|
||||
echo -e "\\n ${CROSS} Unable to update gravity timestamp in database ${gravityDBfile}\\n ${output}"
|
||||
fi
|
||||
}
|
||||
|
||||
# Import domains from file and store them in the specified database table
|
||||
database_table_from_file() {
|
||||
# Define locals
|
||||
|
@ -749,6 +759,8 @@ fi
|
|||
gravity_generateLocalList
|
||||
gravity_ShowCount
|
||||
|
||||
update_gravity_timestamp
|
||||
|
||||
gravity_Cleanup
|
||||
echo ""
|
||||
|
||||
|
|
Loading…
Reference in a new issue