Solaris cron job email generation not required


 
Thread Tools Search this Thread
Operating Systems Solaris Solaris cron job email generation not required
# 8  
Old 06-26-2013
Quote:
Originally Posted by hasan.kamali
but still emails are being generated.
What contain these mails ?
Please post a sample including headers.
# 9  
Old 06-27-2013
Hi,

I have executed the code mentioned below:
crontab -l > /tmp/file
grep -v "/dev/null" -n /tmp/file > /tmp/noredirect

and found multiple entries in cron which do not end with '/dev/null'.

And here is the sample email generated by cron:

Your "cron" job on mercury2
/export/home/orbix2/medcamtel.ksh >> /export/home/orbix2/logs/medtel.log 2>>/export/home/orbix2/logs/medtel.log

produced the following output:

! could not obtain latest contract for PID 11571: No such process Thu Jun 27 09:09:00 2013
# 10  
Old 06-27-2013
Well, the cron record looks okay, but something inside the code must be writing to an output file descriptor other than &1 (Standard Output) or &2 (Standard Error)

Can you (without compromising yourself security-wise) post the script?


Robin
# 11  
Old 06-27-2013
yes robin i will definately do that but first let me put '/dev/null' at the end of each and every cron entry.
# 12  
Old 06-27-2013
Are you proposing to therefore stop writing your logs to /export/home/orbix2/logs/medtel.log (in this case)

The problem is output that is not being directed to a file gets sent as an e-mail. You might be losing valuable trace information if you just throw it all away, including whatever you are logging in /export/home/orbix2/logs/medtel.log so far.


Robin
# 13  
Old 06-27-2013
try enclosing the offending line and redirect its output to /dev/null ... this way you do not have to do anything with the scripts at all until you have enough time to do so ... btw, i shortened the original line n the sample as both your stdout and stderr are being redirected to the same file ...
Code:
(/export/home/orbix2/medcamtel.ksh >> /export/home/orbix2/logs/medtel.log 2>>&1) > /dev/null 2>&1

# 14  
Old 06-27-2013
The root cause is unlikely due to missing redirections. The error message sent is from cron itself, not the scripts.

What OS version are you running ? (cat /etc/release)
What user's crontab is affected ?
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