summaryrefslogtreecommitdiff
path: root/templates/service/dns/dynamic/interface/node.def
diff options
context:
space:
mode:
authorMohit Mehta <mohit.mehta@vyatta.com>2008-09-06 01:36:53 +0000
committerMohit Mehta <mohit.mehta@vyatta.com>2008-09-06 01:36:53 +0000
commita684eb06761896b0236619b9506d6699a98af2ba (patch)
treef089e0da09f030819fc977395aff2b8f33fdb057 /templates/service/dns/dynamic/interface/node.def
parentf9c10f6d4d60fba33876f613dfbbf23f58067186 (diff)
downloadvyatta-cfg-quagga-a684eb06761896b0236619b9506d6699a98af2ba.tar.gz
vyatta-cfg-quagga-a684eb06761896b0236619b9506d6699a98af2ba.zip
first attempt at implementing CLI support for Dynamic DNS
Diffstat (limited to 'templates/service/dns/dynamic/interface/node.def')
-rw-r--r--templates/service/dns/dynamic/interface/node.def31
1 files changed, 31 insertions, 0 deletions
diff --git a/templates/service/dns/dynamic/interface/node.def b/templates/service/dns/dynamic/interface/node.def
new file mode 100644
index 00000000..bbf0c310
--- /dev/null
+++ b/templates/service/dns/dynamic/interface/node.def
@@ -0,0 +1,31 @@
+tag:
+help: Set interface to send DDNS updates for
+type: txt
+syntax:expression: exec "
+ intf_array=($(awk '$1 ~ /:/ { print $1 }' /proc/net/dev))
+ intf_array_len=${#intf_array[*]}
+ i=0
+ while [ $i -lt $intf_array_len ]; do
+ temp=${intf_array[$i]%:*}
+ if [ \"$temp\" == \"$VAR(@)\" ] ; then
+ exit 0
+ fi
+ let i++
+ done
+ echo Invalid interface [$VAR(@)]
+ exit 1 "
+
+allowed: local -a array ;
+ array=($(awk '$1 ~ /:/ { print $1 }' /proc/net/dev));
+ echo -n ${array[@]%:*}
+
+commit:expression: $VAR(./@/service/@@) != ""; "Atleast one service must be set to send DDNS updates for $VAR(@)"
+
+delete:expression: "touch /tmp/ddclient_$VAR(@).$PPID"
+
+end:expression: "if [ -f \"/tmp/ddclient_$VAR(@).$PPID\" ]; then \
+ sudo /opt/vyatta/sbin/vyatta-dynamic-dns.pl --stop-dynamicdns --interface $VAR(@) \
+ rm /tmp/ddclient_$VAR(@).$PPID; \
+ else \
+ sudo /opt/vyatta/sbin/vyatta-dynamic-dns.pl --update-dynamicdns --interface $VAR(@); \
+ fi; "