ちょうどinotify-toolsをインストールしました。
/pathフォルダの下のファイルのchksum変更を継続的に検出したいと思います。
変更が検出されると(/パスの下)、印刷されます。
echo "フォルダ/パスの下のファイルのchksumが変更されました。"
これまでのchksum確認方法の例
find /path -type f -name "*.jar" | xargs cksum | awk '{ sum += $1 } END { print sum }'
同様のケースはほとんどありません:
#!/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