[Ultrapossum-cvs 705] ultrapossum/module/dnsbalance ...

Back to archive index

Masato Taruishi taru****@users*****
2004年 10月 7日 (木) 18:53:40 JST


===================================================================
RCS file: ultrapossum/module/dnsbalance/00dnsbalance,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- ultrapossum/module/dnsbalance/00dnsbalance	2004/04/02 02:34:01	1.2
+++ ultrapossum/module/dnsbalance/00dnsbalance	2004/10/07 09:53:40	1.3
@@ -1,6 +1,5 @@
-# Light weight DNS-based balancer for UltraPossum
 #
-# Copyright (C) 2003 VA Linux Systems Japan, K.K.
+# Copyright (C) 2004 VA Linux Systems Japan, K.K.
 #
 # LICENSE NOTICE
 #
@@ -17,7 +16,32 @@
 
 # $Id$
 
-DNSBALANCEDBDIR=${DNSBALANCEDBDIR:-$SYSCONFDIR/bind}
-DNSBALANCEDB=${DNSBALANCEDB:-$DNSBALANCEDBDIR/db}
+case "x$MODULECATEGORY" in
 
-NAMEDCONF=${NAMEDCONF:-/etc/bind/named.conf}
+  xserver|x)
+
+# Defining Variables
+if test "x$cache" = "x"; then
+
+DNSBALANCEDBDIR=$(ultrapossum_getconf DNSBALANCEDBDIR "$SYSCONFDIR/bind")
+DNSBALANCEDB=$(ultrapossum_getconf DNSBALANCEDB "$DNSBALANCEDBDIR/db")
+
+NAMEDCONF=$(ultrapossum_getconf NAMEDCONF "/etc/bind/named.conf")
+
+# Slave IP
+VIRTUALSLAVE=$(ultrapossum_getconf VIRTUALSLAVE `getent hosts $LDAPSLAVE | cut -d' ' -f1 | head -1`)
+
+fi
+
+# Parsing configuration file
+eval "`ultrapossum_parse_config dnsbalance`"
+
+# Calculating Logical Variables
+
+if test "x$ULTRAPOSSUM_MODULE_DNSBALANCE" = "xinstalled"; then
+  :
+fi
+
+  ;;
+
+esac
===================================================================
RCS file: ultrapossum/module/dnsbalance/update-dnsbalance,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- ultrapossum/module/dnsbalance/update-dnsbalance	2004/09/27 09:07:56	1.5
+++ ultrapossum/module/dnsbalance/update-dnsbalance	2004/10/07 09:53:40	1.6
@@ -25,8 +25,8 @@
 trap "/bin/rm -f $tmp; eval `ultrapossum-config term`" 0
 
 sanity() {
-  if test "x$VIRTUALSLAVE" != "x"; then
-    for s in $SLAVES $VIRTUALSLAVE
+  if test "x$LDAPSLAVE" != "x"; then
+    for s in $SLAVES $LDAPSLAVE
     do
       load=`getent hosts $s | head -1 | awk -F' ' '{print $2;}'`
       if test "x$load" = "x"; then
@@ -42,16 +42,14 @@
   if test "x$SLAVES" = "x"; then
     echo "W: No slaves defined. slave balancing disabled." 1>&2
     remove
-  elif test "x$VIRTUALSLAVE" = "x"; then
-    echo "W: No virtual slave server defined. slave balancing disabled" 1>&2
-    remove
   else
 
-    load=`getent hosts $VIRTUALSLAVE | head -1 | awk -F' ' '{print $2;}'`
+    load=`getent hosts $LDAPSLAVE | head -1 | awk -F' ' '{print $2;}'`
 
+    install -d "`dirname $DNSBALANCEDB`"
     cat > $DNSBALANCEDB <<EOF
 ;
-; BIND data file for local loopback interface
+; BIND data file for ultrapossum slave servers
 ;
 \$TTL    604800
 @       IN      SOA     $load. root.$load. (
@@ -72,6 +70,9 @@
         echo "@	IN	A	$h" >> $DNSBALANCEDB
       done
     done
+    if test "x$LDAPSLAVE" = "x$MASTER"; then
+        echo "@	IN	A	`getent hosts $MASTER | cut -d' ' -f1`" >> $DNSBALANCEDB
+    fi
  
     if test "x$ULTRAPOSSUMMARK" = "xULTRAPOSSUM"; then
       add_startmark "//" "DNSBALANCE" > $tmp
@@ -89,6 +90,7 @@
 remove() {
   strip_vaconf $NAMEDCONF "DNSBALANCE"
   /bin/rm -f $DNSBALANCEDB
+  /bin/rmdir $DNSBALANCEDBDIR 2> /dev/null || true
 }
 
 case "x$1" in



Ultrapossum-cvs メーリングリストの案内
Back to archive index