LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 10-19-2004, 10:41 AM   #1
cpope67
LQ Newbie
 
Registered: Oct 2004
Posts: 8

Rep: Reputation: 0
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.
 
Old 10-25-2004, 01:55 PM   #2
ugge
Senior Member
 
Registered: Dec 2000
Location: Gothenburg, SWEDEN
Distribution: OpenSUSE 10.3
Posts: 1,028

Rep: Reputation: 45
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.
 
  


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
Cron mail sending using outside SMTP mail server Utah Linux - Software 6 08-24-2005 07:44 PM
Sending output to mail account through cron. gian2oo1 Slackware 2 01-18-2005 12:54 PM
Cron sending mail to root bspicer Linux - General 2 05-01-2002 12:52 PM
Who is Cron and why is he sending me all this mail?... lhoff Linux - Newbie 3 03-06-2002 04:40 PM
Sending Greeting mail to new user ranjit001 Linux - Networking 1 01-02-2001 11:58 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 07:38 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