aboutsummaryrefslogtreecommitdiffstats
path: root/core/entrypoint-tor.sh
diff options
context:
space:
mode:
authorJesús <heckyel@hyperbola.info>2021-07-28 22:40:38 -0500
committerJesús <heckyel@hyperbola.info>2021-07-28 22:40:38 -0500
commit7634cffcb8067b73f021abdec771c09700cd61cb (patch)
tree938a76090e37868c40e39f8b1db6f3f562432219 /core/entrypoint-tor.sh
parent89a254cd79c0eb524ce6dd3b7a67cc8879bad5fd (diff)
downloadyt-local-docker-7634cffcb8067b73f021abdec771c09700cd61cb.tar.lz
yt-local-docker-7634cffcb8067b73f021abdec771c09700cd61cb.tar.xz
yt-local-docker-7634cffcb8067b73f021abdec771c09700cd61cb.zip
improve pid tor check
Diffstat (limited to 'core/entrypoint-tor.sh')
-rw-r--r--core/entrypoint-tor.sh7
1 files changed, 6 insertions, 1 deletions
diff --git a/core/entrypoint-tor.sh b/core/entrypoint-tor.sh
index 7c1e42f..808c2d5 100644
--- a/core/entrypoint-tor.sh
+++ b/core/entrypoint-tor.sh
@@ -15,7 +15,12 @@ EOF
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 [ "$checkurl" = '502' ] || [ "$checkurl" = '302' ]; then
- pkill tor && tor -f /etc/tor/torrc --runasdaemon 1
+ if pgrep tor > /dev/null; then
+ pkill tor > /dev/null
+ tor -f /etc/tor/torrc --runasdaemon 1
+ else
+ tor -f /etc/tor/torrc --runasdaemon 1
+ fi
fi
sleep 5
done