summaryrefslogtreecommitdiff
path: root/templates/service/dns/dynamic/interface/node.def
blob: cf7483bb3f7dbc42da4209bbb39004e245e99bdd (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
tag:
help: Set interface to send DDNS updates for
type: txt

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(@); \
	# generate a warning if interface does not exist on system
        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 Dynamic DNS warning : interface [$VAR(@)] does not exist on system
      fi; "