LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
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, 11: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, 12:08 PM   #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, 12:23 PM   #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 12:33 PM.
 
Old 01-21-2005, 07: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


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 12:16 PM
Cron mail sending using outside SMTP mail server Utah Linux - Software 6 08-24-2005 08:44 PM
sending mail between two mail server !! hitesh_linux Linux - General 3 12-14-2003 01:53 PM
Sending an automatic mail using bash + mail Minuteman Linux - Software 4 08-21-2003 01:49 PM
Sending mail through crontab!! RKris Linux - Software 3 08-27-2002 04:57 PM


All times are GMT -5. The time now is 03:02 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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration