shell监控文件变动后执行自定义命令
shell监控文件变动后执行自定义命令
主要是监测指定文件夹内的变动,比如修改,删除,创建等等
apt-get install inotify-tools -y
1
2
3
4
5
6
7
#!/bin/bash
DIR=/var/www/dmoain/
inotifywait -m -e close_write $DIR --format "%w%f" | while read FILE
do
cat ${FILE} | /usr/bin/supervisorctl update && /usr/bin/supervisorctl reload
done
搞定了就这么简单!记得赋予脚步执行权限!
💘 相关文章
- Configure nginx to only allow cloudflare's IP to connect to the server shell script
- .db数据文件编辑器-sqlitebrowser
- shell腳步監控SoftRaid的N種寫法分享
- Shell Script Batch Generate Continuous Numbers
- Linux中如何同步所有文件(包括隐藏文件、符号链接、硬链接)到远程Linux服务器
- shell脚本批量生成连续数字
- 使用stats一条命令监控memcached
- 解决路由器ip变动的方法
- 基于PHP的文件分享源码
- 常用的linux文件查找命令