目录存在之前重新启动Apache

我有很多域名托pipe在我的服务器上。 一个新的域configuration了通用configuration。 通常用户不知道和删除给apache的documentrootpath的文件夹,有时当我做了更改后重新启动Apache我得到错误,这意味着目录不存在。 是否有可能检查在Apache中为documentroot定义的文件夹的存在,然后停止并启动Apache

总之我想检查存在于httpd.conf中的所有文件夹path,然后再发出命令/etc/init.d/httpd stop。 请任何帮助

在重新启动httpd服务器之前,请执行以下步骤,以便确定是否缺lessDocumentRootpath。

 for i in `grep DocumentRoot /etc/apache2/* -rh | awk '{ print $2 }' | uniq` do [[ -d $i ]] || echo \"$i\" is not in your system done