diff --git a/rootfs/usr/local/etc/docker/init.d/03-tor-server.sh b/rootfs/usr/local/etc/docker/init.d/03-tor-server.sh index ba0628a..64fda8d 100644 --- a/rootfs/usr/local/etc/docker/init.d/03-tor-server.sh +++ b/rootfs/usr/local/etc/docker/init.d/03-tor-server.sh @@ -376,7 +376,7 @@ __post_execute() { ( # commands to execute while :; do - if pgrep unbound >/dev/null 2>&1; then + if __pgrep unbound >/dev/null 2>&1; then break else sleep 10 diff --git a/rootfs/usr/local/etc/docker/init.d/zz-nginx.sh b/rootfs/usr/local/etc/docker/init.d/zz-nginx.sh index 521523a..ad2dc8a 100644 --- a/rootfs/usr/local/etc/docker/init.d/zz-nginx.sh +++ b/rootfs/usr/local/etc/docker/init.d/zz-nginx.sh @@ -268,10 +268,15 @@ __update_conf_files() { fi # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # define actions - while :; do - echo "waiting for tor to start" - [ -f "/tmp/init_tor_services" ] && sleep 30 || break + # Wait for tor services to complete initialization (with timeout) + local wait_count=0 + local max_wait=10 + while [ -f "/tmp/init_tor_services" ] && [ $wait_count -lt $max_wait ]; do + echo "Waiting for tor services to complete initialization... ($wait_count/$max_wait)" + sleep 10 + wait_count=$((wait_count + 1)) done + [ $wait_count -ge $max_wait ] && echo "⚠️ Timeout waiting for tor services, continuing anyway" echo "The tor server seems to have started " for site in "/run/tor/sites"/*; do onion_site="$(basename -- $site)"