inotifywaitは削除イベントを印刷しません。

inotifywaitは削除イベントを印刷しません。

マニュアルページからinotifywait

EVENTS
...
       unmount
              The filesystem on which a watched file or directory resides was unmounted.
              After this event the file or directory is no longer being watched.  Note
              that this event can occur even if it is not explicitly being listened to.

私はそれを動作させようとしていますが、成功しませんでした。 watchディレクトリをアンロードした後でも、プログラムは実行され続け、何も印刷されません。

テスト準備:

cd /tmp/
fallocate -l500M test.img
mkdir -p /media/test
losetup -f test.img
mkfs.ext4 /dev/loop0
mount /dev/loop0 /media/test
inotifywait -m /media/test &
inotifywait -m /media &

他のイベントが動作しているかテストします。

[root@basinsrv tmp]# touch /media/test/xxx
/media/test/ CREATE xxx
/media/test/ OPEN xxx
/media/test/ ATTRIB xxx
/media/test/ CLOSE_WRITE,CLOSE xxx
[root@basinsrv tmp]#

削除:

[root@basinsrv tmp]# umount /media/test
[root@basinsrv tmp]#

私のシステム:

[root@basinsrv tmp]# uname -a
Linux basinsrv 3.10.0-957.10.1.el7.x86_64 #1 SMP Mon Mar 18 15:06:45 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux
[root@basinsrv tmp]# cat /etc/centos-release
CentOS Linux release 7.6.1810 (Core)

ベストアンサー1

おすすめ記事