Hey otheus thanks for the reply....
I took some points from your reply and from few searches in the forum got it working...
here is my script -
Code:
#!/bin/bash
UPLOAD_DIR="/home/xyz/test"
REPORT_DIR="/home/xyz"
UNAME="xyz"
PASS="xyz"
DB="xyz"
URL="http://www.xyz.com/pdf/"
cd $UPLOAD_DIR
for FILENAME in *.pdf
do
USER_ID=`echo $FILENAME | cut -d "-" -f1`
EMAIL_TO=`echo $(mysql -u $UNAME -p$PASS $DB -e "select email from <tablename> where user_id=$USER_ID") | cut -d " " -f2`
#echo "Send email to $EMAIL_TO"
BODY="blah blah blah"
#echo $BODY
mv $FILENAME $REPORT_DIR
/usr/sbin/sendmail -t <<EOF
From: a@b.com
To: $EMAIL_TO
Subject: <subject>
Content-Type: text/html; charset=us-ascii
$BODY
EOF
done
and this is working. i manually run it and i get the email from this.
now when i schedule it in cron, it doesn't execute.....dont know why
here is the line i used in crontab
Code:
1 * * * * /home/xyz/script.sh
trying to run it every minute...but it doesnt get executed. and i'm not even using any environment variables....can you suggest whats wrong?
Thanks...