Crontab problem in AIX

Hi my script is as below.

#! /bin/sh
get=`ls -l *.ZIP | egrep -c '^-'`
put=`cat Get_File_Count.txt|grep '[0-9]'`
if [ $get -gt $put ]
then
echo $get > Get_File_Count.txt
echo "Hi,\n\nYou've got a new feed!\n\nFilename : `ls -l *.ZIP|sort -k 6|tail -1|cut -c 58-90`" | mail -s "New File Received" user@domain.com
else
echo "No new File"
fi

When i run the script it is running perfectly.

I included the above script in crontab.

MAILTO="user@domain.com"
30 * * * * /usr/informatica/test/infa_shared/SrcFiles/Get_New.sh >/dev/null 2>&1

But i am not getting any mail and also the script is not executing every 30 minutes :frowning:

try adding this line after first line in your script
. $HOME/.profile

Yes,i added it after
#! /bin/sh
is it ok.

Hi!
Why don't you put a statement.
MAILTO="user@domain.com"
in the Get_News.sh script file.
since this parameter can feed to the mail -s command when this script is executed by cron process.

refere to
http://www.panix.com/~kylet/unix-att.html

Still its not getting executed :confused:

is this "Get_File_Count.txt" file getting created??

Yes.It gets a value as per the script.

that means you are getting problem in sending mail
try to refer some crontab manual on google
crontab

Thanks :smiley: