Replace NEW_VALUE with the new setting. For example, configure ip6:your-ipv6-address to add IPv6 or include:spf.yourwebhoster.eu. It will only add the value to domains who do not have this record yet to prevent duplicates.
#!/bin/bash # Copyright 2018 Yourwebhoster.eu # CONFIGURATION # Directory containing the .db files named_dir='/var/named' # String that should be in the txt record. spf_add_value='NEW_VALUE' # DO NOT CHANGE ANYTHING BELOW # Change working dir cd $named_dir # List domains without provided string domains=`grep -L $spf_add_value *.db` for domainDB in $domains; do echo "Updating $domainDB"; perl -pi -e "s/v=spf1 a mx/v=spf1 a mx $spf_add_value/" $domainDB done echo "Updating serials in named files" echo "action=rewrite&value=named" >> /usr/local/directadmin/data/task.queue /usr/local/directadmin/dataskq d800 echo "Restart Named" /usr/local/directadmin/dataskq d800 echo "Done"