zoukankan      html  css  js  c++  java
  • linux inotifywait 下监控是否有IO

    帮助:

    JDU:/host-001e67a8d50b /log/today # inotifywait -h
    inotifywait 3.14
    Wait for a particular event on a file or set of files.
    Usage: inotifywait [ options ] file1 [ file2 ] [ file3 ] [ ... ]
    Options:
        -h|--help         Show this help text.
        @<file>           Exclude the specified file from being watched.
        --exclude <pattern>
                          Exclude all events on files matching the
                          extended regular expression <pattern>.
        --excludei <pattern>
                          Like --exclude but case insensitive.
        -m|--monitor      Keep listening for events forever.  Without
                          this option, inotifywait will exit after one
                          event is received.
        -d|--daemon       Same as --monitor, except run in the background
                          logging events to a file specified by --outfile.
                          Implies --syslog.
        -r|--recursive    Watch directories recursively.
        --fromfile <file>
                          Read files to watch from <file> or `-' for stdin.
        -o|--outfile <file>
                            Print events to <file> rather than stdout.
        -s|--syslog       Send errors to syslog rather than stderr.
        -q|--quiet        Print less (only print events).
        -qq               Print nothing (not even events).
        --format <fmt>    Print using a specified printf-like format
                          string; read the man page for more details.
        --timefmt <fmt>    strftime-compatible format string for use with
                          %T in --format string.
        -c|--csv          Print events in CSV format.
            -t|--timeout <seconds>
                          When listening for a single event, time out after
                          waiting for an event  for <seconds> seconds.
                          If <seconds> is 0, inotifywait will never time out.
        -e|--event <event1> [ -e|--event  <event2> ... ]
            Listen for specific event(s).  If omitted, all events are 
            listened for.
            Exit status:
        0  -  An event you asked to watch for was received.
        1  -  An event you did not ask to watch for was received
        2  -  The --timeout option was given and no events occurred
              in the specified interval of time.
    Events:
        access        file or directory contents were read
        modify        file or directory contents were written
        attrib        file or directory attributes changed
            close_write    file or directory closed, after being opened in writable mode
        close_nowrite    file or directory closed, after being opened in read-only mode
            close        file or directory closed, regardless of read/write mode
        open        file or directory opened
        moved_to    file or directory moved to watched directory
        moved_from    file or directory moved from watched directory
            move        file or directory moved to or from watched directory
        create        file or directory created within watched directory
        delete        file or directory deleted within watched directory
        delete_self    file or directory was deleted
        unmount        file system containing file or directory unmounted

    示例:

    JDU:aSV/host-001e67a8d50b /sf # inotifywait -rme access,modify,open,close /sf/data/vs_rep2/images/
    Setting up watches.  Beware: since -r was given, this may take a while!
    Watches established.
    /sf/data/vs_rep2/images/ OPEN,ISDIR 
    /sf/data/vs_rep2/images/ CLOSE_NOWRITE,CLOSE,ISDIR 
    /sf/data/vs_rep2/images/ OPEN,ISDIR cluster
    /sf/data/vs_rep2/images/cluster/ OPEN,ISDIR 
    /sf/data/vs_rep2/images/ CLOSE_NOWRITE,CLOSE,ISDIR cluster
    /sf/data/vs_rep2/images/cluster/ CLOSE_NOWRITE,CLOSE,ISDIR
  • 相关阅读:
    H5移动前端完美布局之-margin百分比的使用
    javascript 一个关于时间排序的算法(一个页面多个倒计时排序)
    html5 getComputedStyle + resize 实现动态宽高度等比响应式页面设计
    Windows 下关于转码的函数
    项目编译完之后自动提交
    eclipse 包含头文件出错
    Eclipse 包含头文件 添加环境变量
    linux下mongodb程序和c++客户端的编译
    简单谈谈消息发送缓冲区
    epoll 性能分析(解决占用CPU 过高问题)2
  • 原文地址:https://www.cnblogs.com/licongyu/p/4950907.html
Copyright © 2011-2022 走看看