以下是Debian中copidar的使用技巧,涵盖安装、配置及常见操作:
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
copidar /path/to/directory
copidar -r /source/ /destination/
copidar -r --exclude '*.tmp' --exclude 'cache/' /source/ /destination/
-v 选项copidar -r /source/ /destination/ > /var/log/copidar.log 2>&1
~/.config/copidar/config.yaml):watch_directories:
- /path1
- /path2
event_handlers:
- command: /path/to/script.sh
events: [create, modify, delete] # 触发事件时执行脚本
-c 参数指定配置文件运行:copidar -c /path/to/config.yaml
cron 定期运行(如每5分钟):*/5 * * * * /usr/bin/copidar -r /source/ /destination/ >> /var/log/copidar.log 2>&1
--exclude 过滤无关内容。sudo。/var/log/copidar.log),排查异常。tail -f 或日志管理工具(如 logrotate)实时监控输出。提示:若需监控文件系统事件(如创建、修改、删除),优先使用 -r 递归模式结合事件处理器;若仅需同步文件,直接使用 -r -d 选项即可。
参考来源: