Cronjob question about root emails.

I'm running a few cronjobs under a differnt user name that basically do the same thing:

/usr/bin/find /home/userid/userid/archives -mtime +30 -type f -exec /usr/bin/gzip -1vN {} \\\; ; /usr/bin/mv /home/userid/userid/archives/*.gz /msgs/archive_msgs >/dev/null 2>&1

Seems to be working except I keep getting email from root telling me about the execution. When I run the mail command under the other userid:

Message 90:
From root Wed Nov 20 
Date: Wed, 20 Nov 
From: root
To: userid
Subject: Output from cron job /usr/bin/find cronjob line

Cron Environment:

 SHELL = /usr/bin/sh
 PATH=/usr/bin:/etc:/usr/sbin:/usr/ucb:/usr/bin/X11:/sbin:/usr/java5/jre/bin:/usr/java5/bin
 CRONDIR=/var/spool/cron/crontabs
 ATDIR=/var/spool/cron/atjobs
 LOGNAME=userid
 HOME=/home/userid

Your "cron" job executed on server on Wed Nov 20 <time>
/usr/bin/find /home/userid/userid/archives -mtime +30 -type f -exec /usr/bin/gzip -1vN {} \\\; ; /usr/bin/mv /home/userid/userid/archives/*.gz /msgs/archive_msgs >/dev/null 2>&1

produced the following output:
.......
_______________________________________________
I tried using MAIL="" before each line and added the /dev/null and I still get email from root. How can I disable root from sending email to my other userid mailbox about my cronjob executing whether successfully or not?

I'm not familiar with AIX systems, but man crontab on my linux says:

I have that in there and its probably working and my userid running the cronjob most likely isnt sending email. My issue seems to be that root is sending the email to my userid mailbox reporting about the status of the userid cronjob. I'm trying, I guess, to stop root from reporting to my userid mailbox about my cronjobs.

It also might help to omit gzip's verbose option -v . If there is no output from the cronjob, no mail will be sent.

Sure you had MAILTO="" in there?

I just edited the crontab and removed -v. Its strange I cant test it as I schedule a copied line with the current time to run now, and it runs fine with no email. But even if I run it now with the same option -v, no MAILTO= added, or /dev/null added it runs fine and I get no email. Its when it runs in the scheduled AM times is when the mail comes so I wont be able to report back if it actually worked until it runs tonight.

Yes before each line on its own line.

That didnt work :confused:

Can you share, what the actual output from the cron job looks like (what comes after the produced the following output: )?

produced the following output:

/home/userid/userid/archive/filename.txt:     0.0% -- replaced with /home/userid/userid/archive/archive/filename.txt.gz


*************************************************
Cron: The previous message is the standard output
      and standard error of one of your cron commands.

? 

That is pretty much all it says for all of them. The mail is coming from root I believe, and it states above that the standard output and error is being displayed. I thought I was suppressing them by adding /dev/null/ or adding the -v or adding MAIL=

OK,
Let me ask you this, as root you are editing the crontab of other user? or you editing the crontab of root itself?
If your answer is former then I doubt the crontab will execute the script/command. If your answer is latter then, you should receive an email in root's inbox and NOT in other user's.

Hmmm, aixnj, the output you shared is exactly, what gzip prints when executed with the -v option. But a few days ago, you said, that you removed this option from the crontab.

It seems, your change is not in effect. Did you edit the crontab with crontab -e ? This is necessary to inform cron, that the crontab has been changed and needs to be reread. When you "just edit" the crontab file, cron does not reread it and keeps executing the old entry.

The answer is neither. In my case this is another user on the box, and I'm editing that users crontab logged in as that other user, which we want to run it under that user's name of course. So really not using root here, but if you can see from some of the mail I put in this thread, to me at least, seems root is sending the mail about the other user's crontab jobs. We really dont need that.

Ah, guilty as charged. You were right, the change never took. I did user the crontab edit command to make changes. I even killed the cron process, even though I know it auto spawns. But now I triple checked and it seems to have taken my edit so I'll see how it runs tonight. Mind you I now have:

Added

MAILTO= 

Added

>/dev/null

Removed

-v

Just wanted to confirm that your suggestions worked. Thanks guys. :b: