inotifywait的脚本,系统上临时监控够用了

#!/bin/bash
inotifywait -mrq --timefmt '%y%m%d%H%M' --format '%T %w%f %e' --event delete,modify,create,attrib /data/web | while read date file event
    do
        case  $event  in
            MODIFY|CREATE|MOVE|MODIFY,ISDIR|CREATE,ISDIR|MODIFY,ISDIR)
            echo  $event' - '$file' - '$date >> /var/log/web_watch.log
            ;;

            MOVED_FROM|MOVED_FROM,ISDIR|DELETE|DELETE,ISDIR)
            echo  $event'-'$file'-'$date >> /var/log/web_watch.log
            ;;
        esac
    done

发表回复

您的电子邮箱地址不会被公开。