mail from Cronjob


 
Thread Tools Search this Thread
Top Forums UNIX for Advanced & Expert Users mail from Cronjob
# 1  
Old 11-06-2002
Question mail from Cronjob

Hi,
I'm having a HP UX 11i and 11.0 . I've given the cron access to one of the user. Now he is getting mails on errors only and not on success on execution of the command. How can i make sure that the mail is sent in both the cases of success and failure. Also the mail is going to the lotus notes mailbox. Where can i change it, and sent the mail to his unix mail box only?
Thanks
Dhanish
# 2  
Old 11-06-2002
Provide us with more information.. the command and all...

Is the mail (or mailx) command issued from crontab or command line?

Cheers!
Vishnu.
# 3  
Old 11-06-2002
No crond I've ever seen mails on success, just failures.
You can set up the program/script/command to mail on success...

For the other issue, try reading the results of the command "man crontab"
# 4  
Old 11-08-2002
I'm not mentioning about any specific command. I get the mail only on faliure, regardless on the command i use. Now i want to know where can i change this, like say if i want to change the failure mails to be sent to user@hostname.com rather than to user@company.com ? I was not able to find it in the man pages as well. Hope it clear this time
# 5  
Old 11-08-2002
Do your cron entries have 2>&1 in them? If so, this is telling it to send email only on failure. Cron usually sends email on success or failure. Most people don't want the successful ones, only wanting to know when it failed. Or they just send output to a log file to look at it later (or mail the log file after the job is completed).

To change where the email goes, either set it up that the output goes to a log file and email the results after the job is done to the different user, OR you can change the alias for user@hostname to send mail to user@company.com.

Or someone can give another option -
# 6  
Old 11-08-2002
take a look in the following places:
Code:
/etc/crontab
/etc/aliases

# 7  
Old 11-15-2002
The following sends email to a loguser with the output from the "command".


crontab entry for the user:
* * * * * /path/command 2>&1 | mail -s "command report rc=4?" logmaster

/etc/aliases file directing email to root at the local host:
logmaster: root@localhost

compile the aliases file with sendmail -bi
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. UNIX for Advanced & Expert Users

Client was not authenticated to send anonymous mail during MAIL FROM (in reply to MAIL FROM comm

I am having trouble getting mail to work on a red hat server. At first I was getting this message. Diagnostic-Code: X-Postfix; delivery temporarily suspended: connect to :25: Connection refused Then added the port to my firewall. Then I temporarily turned off selinux. I then copied this file... (1 Reply)
Discussion started by: cokedude
1 Replies

2. UNIX for Advanced & Expert Users

need to configure mail setting to send mail to outlook mail server

i have sun machines having solaris 9 & 10 OS . Now i need to send mail from the machines to my outlook account . I have the ip adress of OUTLOOK mail server. Now what are the setting i need to do in solaris machines so that i can use mailx or sendmail. actually i am trying to automate the high... (2 Replies)
Discussion started by: amitranjansahu
2 Replies

3. Shell Programming and Scripting

Cronjob to notify by mail

I am planning some tasks that I need send mails regularly to my team members. I think to use cronjob with script to do it. Two init files are prepared, I can change the format if you ask for. name.txt: Bill bill@xxx.com Peter peter@xxx.com James james@xxx.com Tasks_list.txt ... (4 Replies)
Discussion started by: newoz
4 Replies

4. 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

5. UNIX for Dummies Questions & Answers

How to send html file in a mail not as an attachment but it should display in the mail in table for

Hi The below script working when we are sending the html as attachment can u please guide how to send thesmae data in table form direct in the mail and not in mail attachment . cat Employee.sql SET VERIFY OFF SET PAGESIZE 200 SET MARKUP HTML ON SPOOL ON PREFORMAT OFF ENTMAP ON - HEAD... (0 Replies)
Discussion started by: mani_isha
0 Replies

6. Solaris

how to forward mail in /var/mail/username to external mail

Dear All, Now I use solaris 10 and I try to forward mail from /var/mail/username to their external mail so what should I do? thank u in advance (2 Replies)
Discussion started by: unitipon
2 Replies

7. Shell Programming and Scripting

Cronjob - Redirect mail output to file, LINES & COLUMNS

I currently have an expect script that issues the 'mail' command and sends an 'x' when it receives the & prompt from mail to quit. The expect script is able to do stty rows 100 columns 200 < $spawn_out(slave,name) to set up the number of columns and rows. I would like to get rid of the expect... (0 Replies)
Discussion started by: jharvey
0 Replies

8. UNIX for Dummies Questions & Answers

mail problem (NOT Mail or Mail.app)

When I try to use the CLI mail, I get the following error. What's wrong? Welcome to Darwin! % mail root Subject: test test . EOT % /etc/mail/sendmail.cf: line 81: fileclass: cannot open /etc/mail/local-host-names: Group writable directory Do I just need to change the... (1 Reply)
Discussion started by: chenly
1 Replies

9. Shell Programming and Scripting

Cronjob

Please can someone help me. I need to set up a cron job to measure CPU usage, Disk I/O and memory usage over a period of 1 minute along with the number of users logged into the system. I also need to send it to another user besides myself every hour. Please can someone help me! Thanks. (4 Replies)
Discussion started by: gerwhelan
4 Replies
Login or Register to Ask a Question