From 5523afa0e5f07667086270ac2e94d825582d1a7d Mon Sep 17 00:00:00 2001 From: Samir Benmendil Date: Tue, 19 Jul 2016 23:47:54 +0100 Subject: [PATCH] bin: use dig for getting ip it's very fast and will always work(tm) --- bin/whatsmyip | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/bin/whatsmyip b/bin/whatsmyip index 8f6cbc7..2e6c6c3 100755 --- a/bin/whatsmyip +++ b/bin/whatsmyip @@ -1,4 +1,7 @@ #!/bin/bash -# only works behind DD-WRT router -#ssh root@192.168.1.3 -p 2222 -q "nvram get wan_ipaddr" -curl -s ifconfig.me/ip + +if hash dig 2>/dev/null; then + dig +short myip.opendns.com @resolver1.opendns.com +elif hash curl 2>/dev/null; then + curl -s ifconfig.me/ip +fi -- 2.48.1