以下是通过Copidar监控Debian系统的方法:
sudo apt update
sudo apt install copidar
sudo apt install build-essential cmake git
git clone https://github.com/Copidar/Copidar.git
cd Copidar && mkdir build && cd build
cmake .. && make && sudo make install
~/.config/copidar/config.yaml
或/etc/copidar/config.yaml
中设置监控目录、事件类型等,例如:watch_directories:
- /path/to/monitor
event_handlers:
- command: /path/to/script.sh
events: [create, modify, delete]
copidar -c /path/to/config.yaml
sudo systemctl status copidar
ps aux | grep copidar
sudo tail -f /var/log/copidar.log
*/5 * * * * /usr/bin/copidar -c /path/to/config.yaml >> /var/log/copidar.log 2>&1
参考来源: