Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

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

Posted on 2000-03-02
5
Medium Priority
?
229 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 150 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: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

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

Introduction Since I wrote the original article about Handling Date and Time in PHP and MySQL several years ago, it seemed like now was a good time to update it for object-oriented PHP.  This article does that, replacing as much as possible the pr…
Every server (virtual or physical) needs a console: and the console can be provided through hardware directly connected, software for remote connections, local connections, through a KVM, etc. This document explains the different types of consol…
HTML5 has deprecated a few of the older ways of showing media as well as offering up a new way to create games and animations. Audio, video, and canvas are just a few of the adjustments made between XHTML and HTML5. As we learned in our last micr…
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 …
Suggested Courses

636 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