![文件更改时重新启动服务](https://linux22.com/image/670302/%E6%96%87%E4%BB%B6%E6%9B%B4%E6%94%B9%E6%97%B6%E9%87%8D%E6%96%B0%E5%90%AF%E5%8A%A8%E6%9C%8D%E5%8A%A1.png)
我希望每次 SCP 新的 HAProxy 配置文件时,Ubuntu 14.04 上的 HAProxy 都会重新启动。实现此目的最简单/最干净的方法是什么?
答案1
使用 inotify 监视文件更改并让其执行执行 haproxy 配置重新加载或完全重启的脚本或命令。
https://superuser.com/questions/181517/how-to-execute-a-command-whenever-a-file-changes
https://stackoverflow.com/questions/12264238/restart-process-on-file-change-in-linux