improve tor change

This commit is contained in:
Jesús 2021-07-29 00:18:16 -05:00
parent 2ad12f2ef9
commit ae37d5106f
No known key found for this signature in database
GPG Key ID: F6EE7BC59A315766

View File

@ -13,14 +13,13 @@ EOF
# check loop health tor # check loop health tor
while :; do while :; do
checkurl=$(curl --socks5 "localhost:${TOR_PORT:-9050}" -o /dev/null -s -w "%{http_code}\n" "${URL_CHECK:-https://www.youtube.com/results?search_query=rms}") if pgrep tor > /dev/null; then
if [ "$checkurl" = '502' ] || [ "$checkurl" = '302' ]; then checkurl=$(curl --socks5 "localhost:${TOR_PORT:-9050}" -o /dev/null -s -w "%{http_code}\n" "${URL_CHECK:-https://www.youtube.com/results?search_query=rms}")
if pgrep tor > /dev/null; then if [ "$checkurl" = '502' ] || [ "$checkurl" = '302' ]; then
pkill tor > /dev/null pkill tor && tor -f /etc/tor/torrc --runasdaemon 1
tor -f /etc/tor/torrc --runasdaemon 1
else
tor -f /etc/tor/torrc --runasdaemon 1
fi fi
else
tor -f /etc/tor/torrc --runasdaemon 1
fi fi
sleep 5 sleep 5
done done