confmodules=`cat /etc/httpd/conf/httpd.conf |grep -v ^#|grep "modules/"|awk '{print $3}'|cut -d "/" -f 2`
for module in $confmodules; do
echo "module=$module"
if [ ! -f /etc/httpd/modules/$module ]; then
linenum=`awk /"$module/{ print NR; exit}" /etc/httpd/conf/httpd.conf`
sed -i "$linenum"s/.*// /etc/httpd/conf/httpd.conf
echo "hey we don't have this $module in /etc/httpd/modules"
fi
done
Basically the script checks all of the modules your httpd.conf tries to load. Then it checks if the file actually exists in /etc/httpd/modules/ and if it doesn't it edits httpd.conf by removing the relevant line for the module that doesn't exist.