inotifywait 無効なオプション -d(デーモン)

inotifywait 無効なオプション -d(デーモン)

次のコマンドを使用して、inotifywaitをデーモンとして実行しようとします。

root@server:/# inotifywait -mrd -e delete -e delete_self -e create -e moved_from -e moved_to /path -o /tmp/path.log

ただし、次のエラーが発生します。

inotifywait: invalid option -- 'd'

私は何が間違っていましたか?

ベストアンサー1

バージョンに問題がありますinotifywait。そしてv3.14には-dパラメータ-oがあり、以前のバージョン 3.13 はまだ使用できません。

この問題は次の方法で解決できます。

#!/bin/bash
inotifywait -qmr -e modify,delete,delete_self,create,moved_from,moved_to /path |
while read line; do
        echo $line >> /tmp/watch.log
done

&コマンドの最後に実行します。

おすすめ記事