我正在创建一个 RPM,在准备阶段,我想确定 apache 的文档根目录,以便我可以将 Web 应用程序文件复制到那里。
首先,我检查是否安装了 apache。如果安装了 apache,脚本将查找 httpd.conf 文件的位置,因为它包含文档根参数。但是我不知道如何处理命令的返回find / -name httpd.conf。我只是 shell 脚本和 RPM 的新手。也想知道这是否可能。目标是让 RPM 可以部署在任何系统上,而无需太多手动干预。波纹管是我计划的代码。它还没有工作
if [ "$(expr substr $(httpd -v) 17 6)" == "Apache"]; then
echo "Apache is installed";
find / -name httpd.conf
//need to handle the return of find and store to a location var to be used on the next line
grep -i 'DocumentRoot' $location/httpd.conf
//need to store the return document root to a var
el
echo "Apache is not …Run Code Online (Sandbox Code Playgroud)