summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjvdias <jvdias@fedoraproject.org>2005-11-13 19:40:55 +0000
committerjvdias <jvdias@fedoraproject.org>2005-11-13 19:40:55 +0000
commit66f2cc4936f3dd4c5a705894ffcbbc3279ad78a1 (patch)
tree2bad9cd2d47f3998523ec6e956797e23801e1f56
parent4b4f5fd507e10bdd08fdfdbd57902dbee5bfce34 (diff)
downloadbind-66f2cc4936f3dd4c5a705894ffcbbc3279ad78a1.tar.gz
bind-66f2cc4936f3dd4c5a705894ffcbbc3279ad78a1.tar.xz
bind-66f2cc4936f3dd4c5a705894ffcbbc3279ad78a1.zip
script to set named forwarders with D-BUS
-rwxr-xr-xnamedSetForwarders52
1 files changed, 52 insertions, 0 deletions
diff --git a/namedSetForwarders b/namedSetForwarders
new file mode 100755
index 0000000..8ee4ce1
--- /dev/null
+++ b/namedSetForwarders
@@ -0,0 +1,52 @@
+#!/bin/bash
+#
+# This script uses the named D-BUS support, which must be enabled in
+# the running named with the named '-D' option, to set the forwarding zones
+# in the running server.
+#
+# One zone argument is required, followed by any number of server IP (v4 or v6)
+# addresses. If the server IP address list is empty, any forwarders for the zone
+# will be removed.
+#
+# Usage:
+# SetForwarders [ -t <'first' | 'only'> ] <zone> [ <server IP> [...<server IP>] ]
+#
+# Copyright(C) Jason Vas Dias<jvdias@redhat.com> Red Hat Inc. 2005
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation at
+# http://www.fsf.org/licensing/licenses/gpl.txt
+# and included in this software distribution as the "LICENSE" file.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+usage() { echo "Usage: SetForwarders [ -t <'first' | 'only'> ] <zone> [ <server> [...<server>] ]"; }
+type=''
+if [ $# -eq 0 ]; then
+ usage;
+ exit 1;
+elif [ "$1" = "-t" ]; then
+ if [ $# -lt 2 ]; then
+ echo '-t option requires an argument.'
+ exit 1;
+ fi;
+ type=$2;
+ shift 2;
+fi;
+if [ $# -lt 1 ]; then
+ echo '<zone> first argument required.'
+ exit 1;
+fi;
+zone='string:'"$1";
+shift;
+servers='';
+if [ $# -gt 0 ]; then
+ for svr in $*; do
+ servers="$servers string:$svr";
+ done
+fi;
+dbus-send --system --type=method_call --print-reply --reply-timeout=20000 --dest=com.redhat.named /com/redhat/named com.redhat.named.text.SetForwarders $zone $type $servers;