enable local DNS server that can provide minimal forward DNS resolution for MyPLC...
[myplc.git] / plc.d / network
index 88ffec0..f84d9aa 100755 (executable)
@@ -7,7 +7,7 @@
 # Mark Huang <mlhuang@cs.princeton.edu>
 # Copyright (C) 2006 The Trustees of Princeton University
 #
-# $Id: network,v 1.2 2006/04/25 21:18:19 mlhuang Exp $
+# $Id: network,v 1.3 2006/05/16 17:09:34 mlhuang Exp $
 #
 
 # Source function library and configuration
@@ -24,9 +24,14 @@ case "$1" in
        (
            for server in API BOOT WWW ; do
                hostname=PLC_${server}_HOST
-               ip=$(gethostbyname ${!hostname})
-               if [ -n "$ip" ] ; then
-                   echo "$ip   ${!hostname}"
+               ip=PLC_${server}_IP
+               if [ -n "${!ip}" ] ; then
+                   echo "${!ip}        ${!hostname}"
+               else
+                   ip=$(gethostbyname ${!hostname})
+                   if [ -n "$ip" ] ; then
+                       echo "$ip       ${!hostname}"
+                   fi
                fi
            done
        ) >>/etc/hosts