LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (http://www.linuxquestions.org/questions/linux-software-2/)
-   -   Sending Mail via cron every hour without user input. (http://www.linuxquestions.org/questions/linux-software-2/sending-mail-via-cron-every-hour-without-user-input-244646/)

cpope67 10-19-2004 11:41 AM

Sending Mail via cron every hour without user input.
 
I am running linux (mandrake) and need to setup a script to send a test email every hour using cron. Cron is not my problem, the mail command is. I tried this:

mail "name@domain.com" -s "test email"

at this point I want "`date`" to be the body of the email and then send. But I can't get it to without manually doing `date` and the "Enter" and the "Control-D" and then go through the "Cc" of which I don't even want.

I am sure this is fairly simple but I am new to Linux and not up to speed on all the command switches, etc.

Thanks for any help.

ugge 10-25-2004 02:55 PM

Try to pipe input to the mail command. Try
Code:

echo `date` | mail "name@domain.com" -s "Test mail"
if that doesn't work try adding a - at the end of the line above.


All times are GMT -5. The time now is 07:24 PM.