#!/bin/sh
MONITORDIR1="/hdd_1/path/to/dir"
MONITORDIR2="/hdd_1/path/to/dir"
#MONITORDIR3="/hdd_1/path/to/dir"
#MONITORDIR4="/hdd_1/path/to/dir"
monitor() {
inotifywait -m -r -e create --exclude '/\..+' --format "%f" "$1" | while read NEWFILE
do
echo "This is an automated email." | mail -s "${NEWFILE} has been added to Daemon!" "[email protected]"
done
}
monitor "$MONITORDIR1" &
monitor "$MONITORDIR2" &
#monitor "$MONITORDIR3" &
#monitor "$MONITORDIR4" &