32 lines
1.2 KiB
Bash
Executable File
32 lines
1.2 KiB
Bash
Executable File
#!/bin/bash
|
|
|
|
# Script de test de progression pour Tor
|
|
# Vérifier si le processus Tor est en cours d'exécution
|
|
if pgrep tor > /dev/null; then
|
|
# Vérifier si le port SOCKS est ouvert
|
|
if ss -ln 2>/dev/null | grep -q ':9050' || netstat -ln 2>/dev/null | grep -q ':9050'; then
|
|
echo 'Tor ready: SOCKS proxy listening on port 9050'
|
|
exit 0
|
|
else
|
|
# Récupérer les logs Docker pour voir la progression du bootstrap
|
|
bootstrap_log=$(docker logs tor-proxy --tail 20 2>/dev/null | grep 'Bootstrapped' | tail -1)
|
|
if [ -n "$bootstrap_log" ]; then
|
|
if echo "$bootstrap_log" | grep -q '100%'; then
|
|
echo 'Tor ready: Bootstrap complete (100%)'
|
|
exit 0
|
|
else
|
|
progress=$(echo "$bootstrap_log" | grep -o '[0-9]\+%' | tail -1 || echo '0%')
|
|
stage=$(echo "$bootstrap_log" | grep -o '(.*)' | sed 's/[()]//g' || echo 'starting')
|
|
echo "Tor bootstrapping: $progress - $stage"
|
|
exit 1
|
|
fi
|
|
else
|
|
echo 'Tor starting: Bootstrap in progress'
|
|
exit 1
|
|
fi
|
|
fi
|
|
else
|
|
echo 'Tor starting: Process not ready'
|
|
exit 1
|
|
fi
|