Something like this?
Code:
cd $UPLOAD_DIRECTORY
find . -type f -newer timestamp -name "*.pdf" -print |
awk -F- { print $1 } |
while read id ; do
email_user_by_id $id
done
touch timestamp
So the email_user_by_id does your SQL query and then sends email. (You can do it in a shell script, but I don't know what your db system is or your table layout, etc). The email part can be like this:
Code:
/usr/sbin/sendmail -t <<EOF
From: "The system" <otheus@xxxx.com>
To: $email
Subject: Your PDF file was received
blah blah blah
EOF