我需要编写一个shell脚本,当在我的5个重写规则文件中检测到任何更改/修改时,将执行/etc/init.d/httpd configtest,如果没有错误,它将重新加载apache。
As suggested in the comments I'd advise you to install inotify:
sudo apt-get install inotify-tools
And after that you can do something as simple as:
while inotifywait -q -e modify filename >/dev/null; do
echo "filename is changed"
done
You can read the manpage for inotifywait
for more info.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.