inotify-toolsを使用して、フォルダの下のファイルのchksum変更を継続的に検出します。

inotify-toolsを使用して、フォルダの下のファイルのchksum変更を継続的に検出します。

ちょうどinotify-toolsをインストールしました。

/pathフォルダの下のファイルのchksum変更を継続的に検出したいと思います。

変更が検出されると(/パスの下)、印刷されます。

echo "フォルダ/パスの下のファイルのchksumが変更されました。"

これまでのchksum確認方法の例

find /path -type f -name "*.jar"  | xargs cksum | awk '{ sum += $1 } END { print sum }'

同様のケースはほとんどありません:

https://superuser.com/questions/956311/continuously-Detect-new-files-with-inotify-tools-within-multiple-directories-r

#!/bin/sh
MONITORDIR="/path/to/the/dir/to/monitor/"
inotifywait -m -r -e create --format '%w%f' "${MONITORDIR}" | while read NEWFILE
do
        echo "This is the body of your mail" | mailx -s "File ${NEWFILE} has been created" "[email protected]"
done

ベストアンサー1

おすすめ記事