update init scripts
[demo.git] / boot / portal_vm_init.sh
index 05e969f..0a2e51e 100644 (file)
@@ -33,7 +33,12 @@ sleep 180
 
 if [ ! -e /opt/config/boot.txt ]
 then
-  IP_ADDRESS=$(ifconfig eth0 | grep "inet addr" | tr -s ' ' | cut -d' ' -f3 | cut -d':' -f2)
+  if [ -e /opt/config/public_ip.txt ]
+  then
+    IP_ADDRESS=$(cat /opt/config/public_ip.txt)
+  else
+    IP_ADDRESS=$(ifconfig eth0 | grep "inet addr" | tr -s ' ' | cut -d' ' -f3 | cut -d':' -f2)
+  fi
   mysql -u root -p'Aa123456' -h $IP_ADDRESS < /opt/portal/deliveries/Apps_Users_OnBoarding_Script.sql
   echo "yes" > /opt/config/boot.txt
 fi