Solved

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

Posted on 2000-03-02
5
213 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
5 Comments
 
LVL 21

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

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

FreeBSD on EC2 FreeBSD (https://www.freebsd.org) is a robust Unix-like operating system that has been around for many years. FreeBSD is available on Amazon EC2 through Amazon Machine Images (AMIs) provided by FreeBSD developer and security office…
SASS allows you to treat your CSS code in a more OOP way. Let's have a look on how you can structure your code in order for it to be easily maintained and reused.
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…
Video by: Mark
This lesson goes over how to construct ordered and unordered lists and how to create hyperlinks.

728 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