Current time: 09-25-2024, 08:33 AM Hello There, Guest! (LoginRegister)


Post Reply 
Complete Hosting Setup
Author Message
robmorin Offline
Junior Member
*

Posts: 208
Joined: Apr 2007
Reputation: 0
Post: #5
RE: Complete Hosting Setup
With respect to teh secondary or 3rd name servers...

Because apache could stop working or go down, the script would then generate an empty file, or bind not restarting due to syntax error, i do it this way...

Keep in mind i am not a programing guy in any way.. Smile

The QazwsxedC.php file is that php file that generates the secondary stuff, i just double check everything after that......


#!/bin/bash

### Actually generate the secondary entries in a file and remove unwanted lines
ssh xx.xx.xx.149 sudo -u vu2000 php4-cgi -f /var/www/ispcp/gui/admin/dido/QazwsxedC.php |grep -v "<" >/var/tmp/named.secondary.tmp

### Simply replace a string that would cause bind to break
perl -pi -e 's/server Server Joe/#server Server Joe/g' /var/tmp/named.secondary.tmp


### Checking the secondary file to make sure it is OK as per BIND

BIND_syntax_test=$(/usr/sbin/named-checkconf /var/tmp/named.secondary.tmp &>/dev/null)$?

if [ $BIND_syntax_test -gt 0 ]
then
echo " *** There is something wrong with the named.secondary.tmp conf file on DNS2, located in /var/tmp OR it does not exist! Keeping existing file*** "
echo "Named.secondary zone file problem on DNS2, SYNTAX Error!" | mail rob@domain.ca -s "DNS2 **** Syntax error in named.secondary.tmp file on DNS2 ****"
# echo $BIND_syntax_test
exit

else

if [ -s /var/tmp/named.secondary.tmp ]
then
echo " The named.secondary.tmp file is OK"
cp /var/tmp/named.secondary.tmp /etc/bind/named.secondary
BIND_error_status=$(/etc/init.d/bind9 force-reload &>/dev/null)$?
else
echo "Named.secondary.tmp file problem on DNS2, its ZERO SIZE!" | mail rob@domain.ca -s "DNS2 **** Named.secondary.tmp zone file problem ****"
fi
fi


BIND_dido_test=$(grep "dido.ca" /var/tmp/named.secondary.tmp &>/dev/null)$?

if [ $BIND_dido_test -gt 0 ]
then
echo "Dido Zone file problem on DNS2, its not there!" | mail rob@domain.ca -s "DNS2 **** Dido zone file problem ****"
fi

# Just for testing below
#echo "Bind Error status--> $BIND_error_status"
#echo "Bind Syntax status --> $BIND_syntax_test"
#echo "Bind Dido status --> $BIND_dido_test"


HSorgYves Wrote:Check http://www.isp-control.net/documentation...nameserver
(This post was last modified: 05-10-2008 01:08 AM by robmorin.)
05-10-2008 01:04 AM
Find all posts by this user Quote this message in a reply
Post Reply 


Messages In This Thread
Complete Hosting Setup - viperiii - 05-02-2008, 08:25 AM
RE: Complete Hosting Setup - HSorgYves - 05-03-2008, 02:38 AM
RE: Complete Hosting Setup - viperiii - 05-03-2008, 02:46 AM
RE: Complete Hosting Setup - robmorin - 05-10-2008 01:04 AM
RE: Complete Hosting Setup - weblivehelp - 05-03-2008, 06:40 PM

Forum Jump:


User(s) browsing this thread: 2 Guest(s)