Just want to add here on Scott's comment, Cron has an own reserved syslog facility, so you should have a look into /etc/syslog.conf (or the equivalent file in your distro) to see where messages of facility cron are sent. Also you can check /var/spool/mail/user_name too for same. Let us know is this helps.
EDIT: Also while checking your script I found out that line if diff $TMP $TMP_FILE >/dev/null
I think what you are trying to do here to, not to display the differance in standard output, this command will redirect output to /dev/null so each time condition will be FALSE and if I am right here then you can use following then.
Here is an example which I have tested for same.
Now check this following command out.
if [[ -z $(diff chumm1 chumm2 2&>1 /dev/null)
echo "There are differances.";
echo "there is nothing";
Ravinder, the diff is okay; the redirection of stdout does not clear the exit status.
In fact your correction is faulty:
2&>1 should be 2>&1 (redirect stderr to descriptor 1, and should be appended to also go to /dev/null), but is not needed for diff AFAIK.
Actually I don't see anything wrong in the script. Note that email.users is expected in the cron user's home directory.
The Following 2 Users Say Thank You to MadeInGermany For This Useful Post:
There doesn't appear to be anything wrong with the script. As Don said (post#2), nearly all these things are because the interactive login and cron environments are different; perhaps the variables set in .profile, or the path searched. These things need to be deliberately set at the start of the script to match those in effect when the script is run interactively.
Read again Don's post#2.
The Following User Says Thank You to hicksd8 For This Useful Post: