Welcome to the most active Linux Forum on the web.
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
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!


  Search this Thread
Old 01-31-2003, 05:18 AM   #1
LQ Newbie
Registered: Jan 2003
Posts: 2

Rep: Reputation: 0
Send Email + Txt Attachment Using Cron Job

Hi there,

complete newbie to cron jobs but some experience with Telnet commands, configuration of scripts etc etc..

I want to do the following, which I assume can/should be done with a cronjob.

We want to setup a feedback form and the output will be stored in a text file - no big deal so far and no help needed.

Problem 1:
Now I'd like to send this tab delimited text file at one certain time of every day to two email recipients as an attachment. Anywhere where I could find help on this or hints ..are highly appreciated. Our server can handle cron jobs that is no problem.

Problem 2:
The optimum scenario would be that instead of having an accumulating txt file which would cause old entries sent again and again to only send new form input that has come in in the 24 hour period after the last sending of the mail ...

Any ideas or hints on how to get this done ?

Thx in advance

Old 01-31-2003, 06:29 AM   #2
Registered: Sep 2002
Distribution: Slackware 8.1
Posts: 84

Rep: Reputation: 15
Never done this, but with text files you should look at mail(1).
It supports input from std in, and has escape sequences with which
you can add commands to the input.

1.)Try createing a here file composed of the file you want to send, with command that insert subject, recipients, etc.

2.)At the time of sending archive the old file by renaming it, maybe add a date string. Then at the next run only the recent (since last run) inputs will be used, then archive this file too. Don't know if thats possible for you're setup.
Another possibility would be to count the lines contained in the file at the time of sending using wc(1), then count the number of lines at the next run, calculate the difference and use tail(1) to extract the lines since last send.
Old 01-31-2003, 07:19 AM   #3
Registered: May 2001
Posts: 29,415
Blog Entries: 55

Rep: Reputation: 3594Reputation: 3594Reputation: 3594Reputation: 3594Reputation: 3594Reputation: 3594Reputation: 3594Reputation: 3594Reputation: 3594Reputation: 3594Reputation: 3594
Old 01-31-2003, 10:23 AM   #4
LQ Newbie
Registered: Jan 2003
Posts: 2

Original Poster
Rep: Reputation: 0
Thx guys ... will give it a try ....


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 job email results... ryedunn Linux - General 7 01-26-2005 10:27 PM
cron job to send file via ftp every 1 hour mcalizo Linux - Newbie 1 07-14-2004 03:50 AM
cron job that email a text file paynsr Linux - Newbie 1 03-29-2004 01:36 PM
usin AWK in cron job to send dynamic ip via email digihlp Programming 2 12-10-2003 08:10 AM
Cron job , send email mikeshn Linux - General 1 09-21-2003 09:02 AM > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 08:22 AM.

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