Commit 66e47006 authored by anonym's avatar anonym Committed by kytv

Log Tor's bootstrapping status to syslog.

parent c9b58900
......@@ -8,6 +8,10 @@ set -e
# Import tor_bootstrap_progress()
. /usr/local/lib/tails-shell-library/tor.sh
# Import log()
. /usr/local/lib/tails-shell-library/log.sh
_LOG_TAG="$(basename $0)"
# The Tor log is removed to ensure `tor_bootstrap_progress`'s output will be
# accurate.
clear_tor_log() {
......@@ -30,12 +34,14 @@ last_bootstrap_change=$(date +%s)
maybe_restart_tor() {
local new_bootstrap_progress=$(tor_bootstrap_progress)
if [ $new_bootstrap_progress -eq 100 ]; then
log "Tor has successfully bootstrapped."
return 0
elif [ $new_bootstrap_progress -gt $bootstrap_progress ]; then
bootstrap_progress=$new_bootstrap_progress
last_bootstrap_change=$(date +%s)
return 1
elif [ $(expr $(date +%s) - $last_bootstrap_change) -ge 20 ]; then
log "Tor seems to have stalled while bootstrapping. Restarting Tor."
clear_tor_log
service tor restart
bootstrap_progress=0
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment