Redirection
of Website to Error Page after Not Responding in Linux OS
$ vi /home/script
open a file and copy following
script on server.
#!/bin/bash
#Please enter IP Address of server
and port on which application is running.
# For Ex - x=`nc -w2
-z 172.16.0.1 80 2>&1`
x=`nc -w2 -z <IP ADDRESS>
<PORT> 2>&1`
if [ $? != 0 ];then
cp -f
/etc/httpd/conf/httpd_error.conf /etc/httpd/conf/httpd.conf
service httpd reload
else
y=`grep -lir "down1"
/etc/httpd/conf/httpd.conf`
if [ $? = 0 ];then
cp -f /etc/httpd/conf/ httpd_right.conf
/etc/httpd/conf/httpd.conf
service httpd reload
else
echo "already up"
fi
fi
Configure Script in crontab to check
connectivity of Website at every 1 Min.
[root@APP01
conf]# crontab –l
*/1 * * * *
/home/script
Configure Error
Page in “/etc/httpd/conf/httpd_error.conf ” file in path of /etc/httpd/conf
directory and working site in httpd_right.conf file.
[root@APP01
conf]# pwd
/etc/httpd/conf
[root@APP01
conf]# ls /etc/httpd/conf
httpd_error.conf
httpd.conf httpd_right
Scripts
check down1 keyword in /etc/httpd/conf/httpd_error.conf file
so add commented word down1 in it
anywhere.
[root@APP01
conf]# cat /etc/httpd/conf/httpd_error.conf | grep down1
##down1
This comment has been removed by the author.
ReplyDelete