Эх сурвалжийг харах

set ip even if ip doesn't exist

Serghey Rodin 10 жил өмнө
parent
commit
083e820f57
1 өөрчлөгдсөн 5 нэмэгдсэн , 1 устгасан
  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
 }