LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 01-21-2005, 10:33 AM   #1
ryedunn
Member
 
Registered: Jul 2003
Location: Chicago
Distribution: Fedora, ubuntu
Posts: 459

Rep: Reputation: 30
crontab sending mail


Ive read articles that use crontab and they have the results mailed to themselves.. but lets go back one step.. lets say I just wanted crotab to mail me.
22 11 * * * mail -s "test" root

I checked my email at 11:23 am and nothing so I decided to try this from the prompt:
[root@server root]# mail -s "test" root
.
Cc:
Null message body; hope that's ok

hmm.. I had to put the extra "." to end the body and still got prompted for a CC:... is this what could be messing up the process? How can I avoid this?

The GNUbie
 
Old 01-21-2005, 11:08 AM   #2
wpn146
Member
 
Registered: Jan 2005
Distribution: Solaris, Linux Fedora Core 6
Posts: 170

Rep: Reputation: 30
You might try to give it a small message body. Try:

22 11 * * * echo "Hi there" | mail -s "test" root
 
Old 01-21-2005, 11:23 AM   #3
ryedunn
Member
 
Registered: Jul 2003
Location: Chicago
Distribution: Fedora, ubuntu
Posts: 459

Original Poster
Rep: Reputation: 30


looks like it works

Last edited by ryedunn; 01-21-2005 at 11:33 AM.
 
Old 01-21-2005, 06:47 PM   #4
twantrd
Senior Member
 
Registered: Nov 2002
Location: CA
Distribution: redhat 7.3
Posts: 1,440

Rep: Reputation: 52
I hope you understand why the your original cron entry didn't work. You just proved it right there.

When you ran mail -s "Subject" <recipient>, you had to input a '.' and then an <enter> to complete the mail command. Therefore, when you ran it from cron, it was doing the same thing - it was waiting for some sort of input and that's why you never got your mail.

-twantrd
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Postfix mail transfer agent not sending mail locally or to other servers sketelsen Linux - Software 3 02-09-2006 11:16 AM
Cron mail sending using outside SMTP mail server Utah Linux - Software 6 08-24-2005 07:44 PM
sending mail between two mail server !! hitesh_linux Linux - General 3 12-14-2003 12:53 PM
Sending an automatic mail using bash + mail Minuteman Linux - Software 4 08-21-2003 12:49 PM
Sending mail through crontab!! RKris Linux - Software 3 08-27-2002 03:57 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 11:42 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration