Detecting that log file has been deleted or truncated on POSIX systems?

后端 未结 5 1332
难免孤独
难免孤独 2021-01-13 22:11

Suppose a long-running process writes to a log file. Suppose that log file is kept open indefinitely. Suppose that a careless system administrator deletes that log file.

5条回答
  •  太阳男子
    2021-01-13 22:42

    You could use inotify to watch your log file, monitoring it for file system events.

提交回复
热议问题