1

xfceウィンドウマネージャーを備えたシステムfedora 15があります。

遊ぶためにinotify utilをインストールしました。

作業中に自分のファイルがどうなるかを制御したい。今日、inotifyを実行するために使用するコマンドがあります

inotifywait --fromfile ~/list.inotify

そのコマンドは、読み取りおよび無視するフォルダーとファイルのリストを簡単に読み取ります。私のリストがあります (list.inotify)

/home/alex

@/home/alex/Torrnets/
@/home/alex/.pulse-cookie

したがって、ホーム フォルダーを読み取り、Torrents フォルダーと .pulse-cookie ファイルを無視する必要があります。

トレントも無視します。ただし、.pulse-cookie ファイルは無視されません。

これに対する解決策はありますか?(パターンベースの無視を使用するソリューションを投稿しないでください。絶対パスのファイルリストを操作したいです)

$man inotify
   @<file>
          When watching a directory tree recursively, exclude the specified file from being watched.  The file must be specified with a relative or absolute path according to whether a relative or absolute path is given for watched directories.  If a  specific
          path is explicitly both included and excluded, it will always be watched.

          Note: If you need to watch a directory or file whose name starts with @, give the absolute path.

   --fromfile <file>
          Read filenames to watch or exclude from a file, one filename per line.  If filenames begin with @ they are excluded as described above.  If <file> is `-', filenames are read from standard input.  Use this option if you need to watch too many files to
          pass in as command line arguments.
4

1 に答える 1

2

-e引数を指定しない場合、inotifywaitは で呼び出します。これinotify_add_watchにより、監視対象のディレクトリ内のファイルに対してイベントが発生します - inotify(7)IN_ALL_EVENTSが言うことに注意してください:

ディレクトリを監視している場合、上記のアスタリスク (*) でマークされたイベントがディレクトリ内のファイルに対して発生する可能性があります。この場合、返された inotify_event 構造体の名前フィールドは、ディレクトリ内のファイルの名前を識別します。

問題の inotifywait コードを見ると、ディレクトリのみを監視 (および除外リストをチェック) していることがわかります。ディレクトリではない、またはまったく使用されていない除外を指定するときに警告が表示されると、おそらくもう少しユーザーフレンドリーになるでしょうが、現在はそうです。

于 2011-11-13T14:05:50.257 に答える