Linux通过inotify-tools中的inotifywait组件,在文件夹内容发生变化时自动触发执行相应的脚本
发布时间
阅读量:
阅读量
在搭建一个rpm包管理服务器的过程中,存在一项具体需求,即当新的rpm文件被存入预设目录时,系统需自动触发一段脚本对相关rpm包执行检测操作。
为此,我采用了inotify-tools所提供的inotifywait工具模块,并利用其中用于事件处理的参数-e,具体参数用法可参考其官方手册。
以下为所编写的相关代码:
#/bin/bash
################################################################
# automatically run a script(action.sh) when the contents
# of a directory (${EVENTPATH}) changed.
# pls. install the inotify-tools-3.13-1.el4.rf.i386.rpm module
# before use this scripts
# Aborn Jiang (aborn.jiang@gmail.com)
# Sep.8, 2013
###########
全部评论 (0)
还没有任何评论哟~
