Cronjob question about root emails.


 
Thread Tools Search this Thread
Operating Systems AIX Cronjob question about root emails.
# 1  
Old 11-20-2013
[Solved] Cronjob question about root emails.

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

Code:
/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:

Code:
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:
Code:
 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?

Last edited by Franklin52; 11-20-2013 at 03:17 PM.. Reason: Please use code tags per the Forum Rules
# 2  
Old 11-22-2013
I'm not familiar with AIX systems, but man crontab on my linux says:
Quote:
... If MAILTO is defined but empty (MAILTO=""), no mail will be sent. ...
# 3  
Old 11-22-2013
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.
# 4  
Old 11-22-2013
It also might help to omit gzip's verbose option -v. If there is no output from the cronjob, no mail will be sent.
# 5  
Old 11-22-2013
Sure you had MAILTO="" in there?

Quote:
Originally Posted by aixnj
I tried using MAIL="" before each line ...
# 6  
Old 11-22-2013
Quote:
Originally Posted by hergp
It also might help to omit gzip's verbose option -v. If there is no output from the cronjob, no mail will be sent.
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.

Quote:
Originally Posted by RudiC
Sure you had MAILTO="" in there?
Yes before each line on its own line.
# 7  
Old 11-26-2013
Quote:
Originally Posted by hergp
It also might help to omit gzip's verbose option -v. If there is no output from the cronjob, no mail will be sent.
That didnt work Smilie
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

Execute Ubuntu 14.04 cronjob as non-root

I have created a cronjob that successfully executes and among other thing runs aria2c to download several files and save them to a folder. However, since it executes as sudo, the downloaded folder is saved with those permissions. Is there a way to execute the cronjob so that the downloaded folder... (4 Replies)
Discussion started by: cmccabe
4 Replies

2. Shell Programming and Scripting

Cronjob for root password change.

Hi, I am writing a cronjob which changes default root password to some designated password(set) after 15 days. The requirement for same is because i need to give application team root access for first 15 days, but after that the default password should be changed, now I want to automate the... (3 Replies)
Discussion started by: nixhead
3 Replies

3. Solaris

Migration of system having UFS root FS with zones root to ZFS root FS

Hi All After downloading ZFS documentation from oracle site, I am able to successfully migrate UFS root FS without zones to ZFS root FS. But in case of UFS root file system with zones , I am successfully able to migrate global zone to zfs root file system but zone are still in UFS root file... (2 Replies)
Discussion started by: sb200
2 Replies

4. Shell Programming and Scripting

Question about cronjob

Dear all, I wrote a script and set it as a cron job to automatically download the data from the website. Here is the problem, when I run this script in terminal, it works well, while it can not download the files when I run it as a cron job, I feel so weird. The script as follows:... (28 Replies)
Discussion started by: handsonzhao
28 Replies

5. Solaris

Simple question: alias not working for root

OS = Solaris 8 Issue: alias not working for root, but working for regular users # grep root /etc/passwd root:x:0:1:Super-User:/:/sbin/sh # alias dir=ls # dir dir: not found # alias dir="ls -l" # dir dir: not found # alias dir='ls -l' # dir dir: not found # alias... (2 Replies)
Discussion started by: aixlover
2 Replies

6. UNIX for Dummies Questions & Answers

how to cancel a cronjob if the cronjob still running

hi everyone I'm newbie in this forum hope I can get some help here :) I have a command in crontab that executed every 1 minute sometime this command need more than 1 minute to finish the problem is, the crontab execute this command although it's not finish processing yet and causing the system... (7 Replies)
Discussion started by: 2j4h
7 Replies

7. Shell Programming and Scripting

Question on Verifying root's current directory

From a script how would I verify that the current directory (.) is not in root's path. Now when the script is going to be run the auditor wil not be signed in as root, but rather running it via sudo, so I'm thinking the standard $path won't work for that case. Derek:confused: (3 Replies)
Discussion started by: sport
3 Replies

8. UNIX for Dummies Questions & Answers

? question mark, how to get back to the root directory

hiyas I am trying to get back to the root directory: I went into MAIL directory and now I can't get back to the root directory. What are the commands... I have '?' coming up and I cannot proceed with this, HELP Cheers (1 Reply)
Discussion started by: etravels
1 Replies

9. UNIX for Dummies Questions & Answers

Root login question

Hi all I am administering Linux boxes (running rehat linux 7.3 and 8.0). The other day I tried to ssh from 1 linux box to the other. I was root on the client box. Surprisingly, I could login as root into the host after giving the password!! I am unable to get root login from a SSH client... (2 Replies)
Discussion started by: skotapal
2 Replies

10. UNIX for Dummies Questions & Answers

Cronjob question

Hi folks! I set up a cronjob yesterday to excute this morning at 4am. The problem I am experiencing is that the script that is executed cannot find specified files which it is suppose to run like my file.sql and other various scripts which are in the same directory as the exucutable script. ... (4 Replies)
Discussion started by: maverick
4 Replies
Login or Register to Ask a Question