문제

I am using a CentOS server, and i want to get a remote dynamic ip in a value to use in a script. Right now the script gets the ip like this:

    current_ip=$(curl --silent http://ipecho.net/plain)

but since i am moving the script to a server, i need it to ping my dyndns domain name and get my ip since its going to be changing every now and then. Is there a way to do this with ping or something ? So i can add in current_ip my ip every time the script executes ? -Thanks

도움이 되었습니까?

해결책

To resolve a domain name, try the host utility:

$ host -t A stackoverflow.com
stackoverflow.com has address 198.252.206.140
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top