Solved

Sending a message that includes a text file to an IMAP server every 30 minutes

Posted on 2000-03-02
5
193 Views
Last Modified: 2013-11-18
I would like to know how to automate and build a script that will send a text file as an email to a user(s) ever 30 minutes.  I have the following simple script that builds a simple text file....

while true
do
processname >> processtxt
sleep 1800
done

I execute this with the nohup option and use the & parameter.
I would now like to mail the processtxt file to an email recipient every 30 minutes.
Help would be greatly appreciated.
BC
0
Comment
Question by:bcornele
5 Comments
 
LVL 20

Accepted Solution

by:
tfewster earned 50 total points
ID: 2579778
How about :

while true
do
  processname > processtxt   #Note, not >>
  mail useraddress < processtxt
  sleep 1800
done

I can't help you much on the mail addressing/routing tho' :(

Hope this helps
0
 

Expert Comment

by:sivaran
ID: 2580117
Try putting the batch in cron tab file and execute the file every 30 minutes
and also put a cron file for sending out the mail.

sivaran
0
 
LVL 1

Expert Comment

by:sereda
ID: 2580157
crontab -e
--- editor pops up
--- add following line:
0,30 * * * * processname | mail user@email
--- close file

And that's it. No need for additional file and script.
0
 

Author Comment

by:bcornele
ID: 2582408
While I am familiar with crontab, I am trying to keep this in a script I can execute from my home directory using the nohup command with the & arg.  I rejected your answer because I needed script coding lines to compliment my existing script.  Thanks. BC
0
 

Author Comment

by:bcornele
ID: 2582416
The pipe of the processtxt clued me in on how to pipe a chunk of data to mailx using the -s option with a subject line.

Here is the final script with your modifications.

while true
do
processname >> processtxt
mailx -s "Subject Line" user@domain.com < processtxt
sleep 1800
done

Thanks for you information and prompt repsponse to my question.
BC
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
NTP Server in VMware 5 159
UNIX SCP 5 64
Problem to Popup 2 74
How to write an English digest paper 6 16
Most of the sites are being standardized with W3C Web Standards. W3C provides lot of web standard services to the web. They have the web specification, process and documentation for all the web standards. You can apply HTML, CSS and Accessibility st…
I will show you how to create a ASP.NET Captcha control without using any HTTP HANDELRS or what so ever. you can easily plug it into your web pages. For Example a = 2 + 3 (where 2 and 3 are 2 random numbers) Session("Answer") = 5 then we…
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

943 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

5 Experts available now in Live!

Get 1:1 Help Now