The UNIX and Linux Forums  

Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Dummies Questions & Answers
.
google unix.com




View Single Post in the UNIX and Linux Forums - Click on the Thread or Permalink to View Entire Thread -->
  #2 (permalink)  
Old 06-30-2009
otheus's Avatar
otheus otheus is offline Forum Staff  
Moderator ala Mode
  
 

Join Date: Feb 2007
Location: Innsbruck, Austria
Posts: 1,886
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