Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Simplify and generalize SERVER_IP detection #4

Open
infamousjoeg opened this issue Aug 23, 2018 · 0 comments
Open

Simplify and generalize SERVER_IP detection #4

infamousjoeg opened this issue Aug 23, 2018 · 0 comments

Comments

@infamousjoeg
Copy link

export server_ip=$(ifconfig | grep -Eo 'inet (addr:)?([0-9]*\.){3}[0-9]*' | grep -Eo '([0-9]*\.){3}[0-9]*' | grep -v '127.0.0.1'|grep -v 172*)

An easier and more effective way of doing this is:

hostname -I | awk '{print $1}'

I have ran into issues in certain VM environments and in AWS using the current method that was resolved globally by making this change.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant