#!/bin/sh
named_dir=/etc/namedb # Set to path of your bind database files.
oldtext="mailbox.mytest.com" # Replace with original line to search for.
newtext="mailbox2.mytest.com" # Replace with new line to replace with.
#####################################
if [ `id -u` != "0" ]; then
echo "You must run this as ROOT user only!"
exit 1
else
echo ""
for file in $named_dir/*.db
do
echo "Changing $oldtext to $newtext in file --> $file"
sleep 1
perl -pi -e s/$oldtext/$newtext/ $file
done
echo ""
echo "Now restarted the named service."
echo ""
sleep 4
if [ -f /sbin/service ]; then
clear
/sbin/service named restart
elif [ -f /usr/local/etc/rc.d/named ]; then
clear
/usr/local/etc/rc.d/named restart
else
echo "Could not find the program to restart your version of named."
echo "Please restart it manually."
echo ""
fi
fi
exit 0
admonet said:Is there any need to update the zone serial number?/QUOTE]
Try this:
It should update the serial numbers and restart BIND.Code:echo "action=rewrite&value=named" >> /usr/local/directadmin/data/task.queue
Jeff