- set up cron on a per-server basis
[myplc.git] / plc.d / network
index c00f9d3..d93f4e8 100755 (executable)
@@ -7,13 +7,16 @@
 # Mark Huang <mlhuang@cs.princeton.edu>
 # Copyright (C) 2006 The Trustees of Princeton University
 #
-# $Id: network,v 1.1 2006/04/06 21:51:59 mlhuang Exp $
+# $Id: network,v 1.5 2006/06/23 20:29:22 mlhuang Exp $
 #
 
 # Source function library and configuration
 . /etc/plc.d/functions
 . /etc/planetlab/plc_config
 
+# Be verbose
+set -x
+
 case "$1" in
     start)
        MESSAGE=$"Generating network files"
@@ -22,11 +25,16 @@ case "$1" in
        # Minimal /etc/hosts
        echo "127.0.0.1 localhost.localdomain localhost" >/etc/hosts
        (
-           for server in API BOOT WWW ; do
+           for server in DB 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