Skip to content

Commit

Permalink
Add timeout for proxy to start before freshclam connects
Browse files Browse the repository at this point in the history
  • Loading branch information
nielm committed Nov 24, 2023
1 parent 7ea0e9e commit 0af2f06
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion cloudrun-malware-scanner/bootstrap.sh
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,15 @@ fi
export PROXY_PORT=8888
PROXY_SERVER_ADDRESS=127.0.0.1:${PROXY_PORT}
npm run start-proxy "${CONFIG_FILE}" &
sleep 5
# wait for it to startup before freshclam connects to it...
attempts=10
while [[ $attempts -gt 0 ]]; do
curl -s -I "${PROXY_SERVER_ADDRESS}" > /dev/null 2>&1
[[ $? != 7 ]] && break;
Log INFO main "Waiting for proxy server to start..."
attempts=$((attempts - 1))
sleep 5
done

# This function is used to update clam and freshclam config files.
# Use by specifying the config file on the command line and
Expand Down

0 comments on commit 0af2f06

Please sign in to comment.