0

I've many domain hosted on my server. A new domain is configured with generic configuration. Usually users does not know and delete folders which are given for documentroot path in apache, sometimes when i restart apache after doing changes i get error those means that the directories does not exist. Is it possible to check the existence of folder which are defined for documentroot in apache and then stop and start the apache

in short i want to check existence of all the folders path which are in httpd.conf before i issue the command /etc/init.d/httpd stop. Any help please

User4283
  • 781
  • 3
  • 10
  • 27

1 Answers1

1

Execute following before restarting your httpd server so that you can find out whether any DocumentRoot path is missing or not.

for i in `grep DocumentRoot /etc/apache2/* -rh | awk '{ print $2 }' | uniq`
do 
[[ -d $i ]] || echo \"$i\" is not in your system
done
Suku
  • 2,036
  • 13
  • 15
  • What to do with other directories like Error log and the directory under Directory except Documentroot??? – User4283 Jan 15 '13 at 18:10
  • `$ [ -f "/var/log/apache2/access.log" ] || echo "File not found"` `$ [ -f "/var/log/apache2/error.log" ] || echo "File not found"` – Suku Jan 16 '13 at 01:40