LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   crontab sending mail (https://www.linuxquestions.org/questions/linux-newbie-8/crontab-sending-mail-280519/)

ryedunn 01-21-2005 10:33 AM

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

wpn146 01-21-2005 11:08 AM

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

22 11 * * * echo "Hi there" | mail -s "test" root

ryedunn 01-21-2005 11:23 AM



looks like it works

twantrd 01-21-2005 06:47 PM

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


All times are GMT -5. The time now is 04:28 PM.