Continuously detect a change of chksum of files under folder with inotify-tools

0

I just installed inotify-tools.

I would like to continuously detect change of chksum of files under folder /path

Once a change was detect ( under /path ) then it will print

echo “chksum of files under folder /path was change"

example how to check the chksum until now

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

Little similar case is on:

Continuously detect new file(s) with inotify-tools within multiple directories recursively

#!/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" "yourmail@addresshere.tld"
done

King David

Posted 2019-05-22T17:41:36.203

Reputation: 405

No answers