How do I watch a file for changes?

前端 未结 25 2777
孤街浪徒
孤街浪徒 2020-11-21 07:13

I have a log file being written by another process which I want to watch for changes. Each time a change occurs I\'d like to read the new data in to do some processing on it

25条回答
  •  执笔经年
    2020-11-21 08:13

    Check out pyinotify.

    inotify replaces dnotify (from an earlier answer) in newer linuxes and allows file-level rather than directory-level monitoring.

提交回复
热议问题