litespeedtech / ls-cloud-image

GNU General Public License v3.0
36 stars 38 forks source link

per-instance.sh: Fix PUBIP function #15

Closed merkys7 closed 4 years ago

merkys7 commented 4 years ago

Happy easter! @Code-Egg I hope you are doing well

I would like to inquire about the potential fix for the following line: https://github.com/litespeedtech/ls-cloud-image/blob/38430f2373f87d74f2c085e8cfa196255c06447b/Cloud-init/per-instance.sh#L143

The problem: Command: ip -4 route get 8.8.8.8 | awk {'print $7'} | tr -d '\n' doesn't return anything on OpenVZ container.

The correct command on OpenVZ would be:

ip -4 route get 8.8.8.8 | awk {'print $5'} | tr -d '\n'

I suggest the solution to use universal method such as: curl -4 icanhazip.com because routes are different on every provider

What do You think?

Code-Egg commented 4 years ago

HIHI,

Will do. Do you think curl -s http://checkip.amazonaws.com || printf "0.0.0.0" is more stable/reliable than icanhazip.com?

merkys7 commented 4 years ago

I think checkip.amazonaws.com is more stable

Code-Egg commented 4 years ago

https://github.com/litespeedtech/ls-cloud-image/commit/210ff2c54b0dbe1b71d2d35713560440d8af7a68

All done

merkys7 commented 4 years ago

Thank You very much

Code-Egg commented 4 years ago

Sure thing, let me know if there's any more suggestions.