我需要编写一个 shell 脚本,当检测到我的 5 个重写规则文件中的任何更改/修改时,将执行/etc/init.d/httpd 配置测试,如果没有错误,它将重新加载 apache。
最佳答案
根据评论中的建议,我建议您安装 inotify:
sudo apt-get install inotify-tools
然后你可以做一些简单的事情:
while inotifywait -q -e modify filename >/dev/null; do
echo "filename is changed"
done
您可以阅读 inotifywait
的联机帮助页以获取更多信息。
关于linux - 需要 shell 脚本,当检测到我的 5 个重写规则文件中的任何更改/修改时,将执行/etc/init.d/httpd,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41954314/