2014-02-13 23 views
0

我有一個Linux命令行程序。如何檢查文件在linux中被更改的時間?

它產生輸出到文件。

輸出文件在短時間間隔後被程序連續修改。

每當程序改變文件,我想通知。

是否有任何命令行,或任何腳本可以幫助我?

+0

「某些處理」。讓你的問題變得模糊不清。請改正。 – Aditya

+0

謝謝@Aditya,現在好點了嗎? – Shan

+0

使用inotifywait:https://github.com/rvoicilas/inotify-tools/wiki或看看http://stackoverflow.com/questions/2972765/linux-script-that-monitors-file-changes-within-folders-like -autospec,不 –

回答

0

我想你需要

的Linux:inotify

File Alteration monitor

incron

Linux audit

也請看看here

此外,腳本您可能需要使用inotify工具如下。

while true; do 
    change=$(inotifywait -e close_write,moved_to,create .) 
    change=${change#./ * } 
    if [ "$change" = "myfile" ] 
    then 
     echo -e "my file changed" 
    fi 
done 
相關問題