diff --git a/cloudrun-malware-scanner/bootstrap.sh b/cloudrun-malware-scanner/bootstrap.sh index f0706f4..459f936 100755 --- a/cloudrun-malware-scanner/bootstrap.sh +++ b/cloudrun-malware-scanner/bootstrap.sh @@ -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