Explorar el Código

set ip even if ip doesn't exist

Serghey Rodin hace 10 años
padre
commit
083e820f57
Se han modificado 1 ficheros con 5 adiciones y 1 borrados
  1. 5 1
      func/ip.sh

+ 5 - 1
func/ip.sh

@@ -178,7 +178,11 @@ get_real_ip() {
         echo $1
     else
         nated_ip=$(grep -H "^NAT='$1'" $VESTA/data/ips/*)
-        echo "$nated_ip" | cut -f 1 -d : | cut -f 7 -d /
+        if [ ! -z "$nated_ip" ]; then
+            echo "$nated_ip" | cut -f 1 -d : | cut -f 7 -d /
+        else
+            get_user_ip
+        fi
     fi
 }