|
|
|
@ -1348,6 +1348,8 @@ check_database_integrity() {
|
|
|
|
|
# Show a text spinner during a long process run
|
|
|
|
|
#
|
|
|
|
|
spinner(){
|
|
|
|
|
# Show the spinner only if there is a tty
|
|
|
|
|
if tty -s; then
|
|
|
|
|
local PID=$! # PID of the most recent background process
|
|
|
|
|
local spin="/-\|"
|
|
|
|
|
local start=0
|
|
|
|
@ -1361,7 +1363,7 @@ spinner(){
|
|
|
|
|
|
|
|
|
|
while [ -d /proc/$PID ]; do
|
|
|
|
|
elapsed=$(( $(date +%s) - start ))
|
|
|
|
|
# print the spinner only on screen (tty) - use hours only if needed
|
|
|
|
|
# use hours only if needed
|
|
|
|
|
if [ "$elapsed" -lt 3600 ]; then
|
|
|
|
|
printf "\r${spin:i++%${#spin}:1} %02d:%02d" $((elapsed/60)) $((elapsed%60)) >"$(tty)"
|
|
|
|
|
else
|
|
|
|
@ -1372,6 +1374,7 @@ spinner(){
|
|
|
|
|
|
|
|
|
|
printf "\r" >"$(tty)" # Return to the begin of the line after completion (the spinner will be overwritten)
|
|
|
|
|
tput cnorm > /dev/tty # Restore cursor visibility
|
|
|
|
|
fi
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
obfuscated_pihole_log() {
|
|
|
|
|