3 #Nsd_ZoneFile="/etc/nsd/zones/example.com.zone"
4 #Nsd_Command="sudo nsd-control reload"
6 # args: fulldomain txtvalue
12 Nsd_ZoneFile
="${Nsd_ZoneFile:-$(_readdomainconf Nsd_ZoneFile)}"
13 Nsd_Command
="${Nsd_Command:-$(_readdomainconf Nsd_Command)}"
16 if [ -z "$Nsd_ZoneFile" ] ||
[ -z "$Nsd_Command" ]; then
19 _err
"Specify ENV vars Nsd_ZoneFile and Nsd_Command"
23 if [ ! -f "$Nsd_ZoneFile" ]; then
26 _err
"No such file: $Nsd_ZoneFile"
30 _savedomainconf Nsd_ZoneFile
"$Nsd_ZoneFile"
31 _savedomainconf Nsd_Command
"$Nsd_Command"
33 echo "$fulldomain. $ttlvalue IN TXT \"$txtvalue\"" >>"$Nsd_ZoneFile"
34 _info
"Added TXT record for $fulldomain"
35 _debug
"Running $Nsd_Command"
36 if eval "$Nsd_Command"; then
37 _info
"Successfully updated the zone"
40 _err
"Problem updating the zone"
45 # args: fulldomain txtvalue
51 Nsd_ZoneFile
="${Nsd_ZoneFile:-$(_readdomainconf Nsd_ZoneFile)}"
52 Nsd_Command
="${Nsd_Command:-$(_readdomainconf Nsd_Command)}"
54 sed -i "/$fulldomain. $ttlvalue IN TXT \"$txtvalue\"/d" "$Nsd_ZoneFile"
55 _info
"Removed TXT record for $fulldomain"
56 _debug
"Running $Nsd_Command"
57 if eval "$Nsd_Command"; then
58 _info
"Successfully reloaded NSD "
61 _err
"Problem reloading NSD"