ahmetb / cloud-run-static-outbound-ip

[DEPRECATED] Sample code for Cloud Run to use a static IP for outgoing requests via a SSH tunnel over a GCE instance
https://cloud.google.com/run/docs/configuring/static-outbound-ip
Apache License 2.0
29 stars 2 forks source link

Illegal option #2

Open BishiBosS96 opened 4 years ago

BishiBosS96 commented 4 years ago

I am not able to deploy since the container cannot be started because of this,

./entrypoint.sh: 15: wait: Illegal option -n

This is my code #!/usr/bin/env bash set -ex ssh -i ./ssh_key "cloud-proxy@${HTTP_PROXY}" \ -N -D ${HTTP_TUNNEL} \ -o StrictHostKeyChecking=no & env HTTPS_PROXY="socks5://${HTTP_TUNNEL}" \ node index.js & wait -n

What could be the problem? Thanks

tek08 commented 4 years ago

I think wait takes a pid these days. instead of -n try $!. Presuming node didn't spawn any child processes, that should be the pid of the last command you ran. If it does start child processes, you can use a clever grep through ps, like:

PID=$(ps aux | grep "<something that identifies your process(es)>" | grep -v grep | tr -s " " | cut -d " " -f 2)