Solaris cron job email generation not required


 
Thread Tools Search this Thread
Operating Systems Solaris Solaris cron job email generation not required
# 1  
Old 06-25-2013
Solaris cron job email generation not required

Hi,

How do we stop default cron job emails bein generated in Solaris 10?

All our cron entries are ending with /dev/null 2>&1 but still emails are being generated.

And all these emails are nuisance, as they are also get relayed to our local network sendmail MTA server (for system email alerts) and overwhelms it.

Everyday we have to delete 50,000+ email queue on our local network sendmail MTA server which is not the right way to run IT operations.
# 2  
Old 06-25-2013
You should probably try to identify and fix the root cause instead of trying to alter a standard behavior.

Why are your cron jobs generating output while asked not to ?

Can you post a sample crontab entry that exhibit the problem ?
# 3  
Old 06-25-2013
you could try enclosing your commands and redirecting to /dev/null (i.e., * * * * * * (some_script) > /dev/null 2>&1) or you could actually go into each script and redirect all unnecessary message outputs (i.e. "rm -f /dir/file 2> /dev/null") as well as comment out all unnecessary echo lines (i.e., "# echo 'i am here') ...
# 4  
Old 06-25-2013
Are you cron entries ending /dev/null 2>&1 or > /dev/null 2>&1?

Without a re-direct for standard output, you are just passing /dev/null as a parameter and redirecting standard error to standard out, which will still generate an e-mail.



It might just be a typo though........



Robin
# 5  
Old 06-26-2013
hi all,
Im hasan.kamali's team member.
here is one of the cron entry which is generating email.
1,4,7, * * * * /med/appl/orbix2/BusinessMediation/bin/start_mediationsocket_servers > /dev/null 2>&1.

and the total script count is in hundreds and it is impossible to reevaluate each single script and add > /dev/null 2>&1 this at the end of lines.
# 6  
Old 06-26-2013
Okay, well the re-direction appears to be okay, but I presume it is writing to a different file-descriptor then. If it is code you can read, is there anything that does a >&3, or perhaps 4, 5 .... that might be causing the e-mail. You may end up suffixing your cron records like this:-
Code:
1,4,7 * * * * /your-script > /dev/null 2>&1 3>&1 4>&1 5>&1 6>&1 7>&1

I must say that it seems an odd definition to run a command on the first, fourth and seventh minute of every hour. It this really it? Well, there must be a need for it. Do you really have:-
  • A comma at the end of 1,4,7,
  • A full stop at the end of the record as in 2>&1.
They could be confusing things too I suppose.

What do you get if you run these on the command line? If you get output, then cron will always e-mail you. I'm assuming that the purpose of the script is not to send an e-mail, of course.




Robin
# 7  
Old 06-26-2013
run this one as the crontab user ...
Code:
crontab -l > /tmp/file
grep -v "/dev/null" -n /tmp/file > /tmp/noredirect

check /tmp/noredirect for the offending entries ... if /tmp/noredirect is empty, re-grep using "> /dev/null" as the search string ...
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Script that will send an email if the cron job did not run.

Team, Would like to know what is the best script that will send you an email if cronjob did not run. Thanks (4 Replies)
Discussion started by: kenshinhimura
4 Replies

2. Shell Programming and Scripting

I want to send an email after cron job

I am using centos 6.4. I have a few cron jobs setup and they all work fine. However, I would like to enhance one of the crons. This is what I have at the moment: nice rsync -au /home/samba/wsaler/* /home/samba/wsaler.backup/wsaler.backup18pm date | /bin/mail -s "wsaler 3:00pm backup... (8 Replies)
Discussion started by: countrydj
8 Replies

3. Shell Programming and Scripting

how to avoid cron job output to send to the junk email folder?

Hi i created a cron job which invoke a shell script and output some content via email. Some times these output are sent to the junk email folder. i want these mails to be sent to inbox with some specific font. what i have to do? (4 Replies)
Discussion started by: vidhyaS
4 Replies

4. Shell Programming and Scripting

Echo print in different lines within email sent by Cron job

Hi all, I think this could have a simple solution, just I canīt get it so far. I have the script below that includes several echo commands in order to show that every part of the script have been executed. A cron job executes this script and when is completed the output is sent by email. ... (4 Replies)
Discussion started by: cgkmal
4 Replies

5. Solaris

How to setup a cron job to run every 45 minutes in Solaris 5.10

How to setup a cron job to run every 45 minutes in Solaris 5.10 (9 Replies)
Discussion started by: reyazan
9 Replies

6. Shell Programming and Scripting

Cron Job Automated Email Alternatives?

Hi guys, not sure if this would be the right place for this but I dont where else it would go... I'm new to Unix too, so please bare with me :) I guess first up some background on the situation. We have some scripts that run as cron jobs which monitor and check the health, etc of our servers.... (2 Replies)
Discussion started by: BrianD
2 Replies

7. Solaris

How to run CRON JOB IN SOLARIS ZONE ??

Hi I am new to solaris zones........... I created a zone in solaris and i am trying to add a cron entry to that by crontab -e but when I enter that command it is just showing 253 number..... But when I enter crontab -l there are some entries my question is how to add cron entry?? when... (3 Replies)
Discussion started by: vijaysachin
3 Replies

8. Solaris

Solaris 10.5 perl and cron job execution problem

Hi, I want to run a crontab job on solaris 10.5. I have configured the crontab accordingly 10 * * * * /scripts/dbalter.pl >> /scripts/cronout.txt However this does not work .Then I go to /var/mail/root and find an error in the output: From root@myserver Wed Feb 4 17:02:00 2009... (1 Reply)
Discussion started by: sonu2die4
1 Replies

9. AIX

Cron Job notification email

Hi, I'm fairly new to Aix and am looking for some help on the following. I have setup a cron job under root and want it to send the email once it's run to an external email address. I can get it to send the output in an email to me by using mail on the end of the crontab entry. But I would... (1 Reply)
Discussion started by: elmesy
1 Replies

10. Solaris

Sun Solaris version 10: cron job does not send the default message.

Hi all, Our servers were on Sun Solaris 8.1, anytime a cron job executed the user ran that job received a email of job's output. I think that the default and Administrator did not setup anything. However, when we upgraded the OS to Sun Solaris ver.10, the cron job is no longer send a email... (2 Replies)
Discussion started by: cmnguyen
2 Replies
Login or Register to Ask a Question