Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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

share|improve this question
add comment

1 Answer

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
share|improve this answer
    
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 1:40
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.