?
Solved

Check file size of /var/spool/mail files

Posted on 2004-09-30
6
Medium Priority
?
423 Views
Last Modified: 2010-04-21
Hi i want to print a user's /var/spool/mail/username file ie mine is /var/spool/mail/jerry , then delete it, but i only want to print it if the file size is greater than 0  or if it is easier if the file is empty . Is there anyway to do this through a cron job or the like that checks every 5 minutes.
Thanks,
Jerry
0
Comment
Question by:jerrycsakanyjr
[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
  • 3
  • 2
6 Comments
 
LVL 23

Expert Comment

by:brettmjohnson
ID: 12194221
Access to the mail spool file is a carefully orchestrated dance,
using file presence/absence, locking, and timestamps.  This
allows the various processes that access the spool file to do so
without corrupting its contents, dropping messages, etc.

Considerable care must be taken to avoid printing or reaping
a file with 1/2 a message appended, or deleting the file while
some mail client is fetching the data.

The spool file itself contains all unread mail concatenated one
after the other.  Formatted messages are encoded in a 7-bit
ASCII plain-text scheme like uue or base-64 as well as MIME
encoding issues.  In other words, simply sending the file to
lpr will probably not give you the most desirable result.
0
 

Author Comment

by:jerrycsakanyjr
ID: 12194279
The purpose of this is  We get confirmation of faxes sent via hylafax to the users home directory in the form of an email. I am trying to figure out how to auto print those confirms, since the users are on win2k stations and some don't even have email setup in outlook and don't have the time to check their emails, so if we could send those emails that are sent to the users home directory to the printer we would be golden. The queuer name is up-middle .  
0
 

Author Comment

by:jerrycsakanyjr
ID: 12194290
correction queue...sorry can't type ;)
0
Linux Academy Android App Now Supports Chromecast

We have some fantastic news for our Android fans. We’re so excited to announce that the Linux Academy Android app is now available with Chromecast support. That’s right – simply download the latest update of the Linux Academy App and start casting your favorite course videos!

 
LVL 23

Expert Comment

by:brettmjohnson
ID: 12194503
I think you want to look into creating a procmail script to do this type of task:

http://pegasus.rutgers.edu/~elflord/unix/procmail.html
http://userpages.umbc.edu/~ian/procmail.html

0
 

Author Comment

by:jerrycsakanyjr
ID: 12196305
I tried writing a procmailrc file that has the following

0:
* ^From:.fax@allstateabstract.com
| lpr -P up-middle

but it just doesn't seem to wanna work for me..what am i doing wrong?
0
 
LVL 38

Accepted Solution

by:
yuzh earned 2000 total points
ID: 12196640
Do you want to print your email (jerry's email) only?

If it is the case, you can create a .forward file and put under jerry's home dir. the .forward
file (text file) with the following format:

"|/usr/bin/lpr -P up-middle -"


If you want to keep a copy of the email in your mail box, and only print the in coming email
make the file looks like:

jerry, "|/usr/bin/lpr -P up-middle -"


0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone 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

Have you ever been frustrated by having to click seven times in order to retrieve a small bit of information from the web, always the same seven clicks, scrolling down and down until you reach your target? When you know the benefits of the command l…
The purpose of this article is to fix the unknown display problem in Linux Mint operating system. After installing the OS if you see Display monitor is not recognized then we can install "MESA" utilities to fix this problem or we can install additio…
Michael from AdRem Software outlines event notifications and Automatic Corrective Actions in network monitoring. Automatic Corrective Actions are scripts, which can automatically run upon discovery of a certain undesirable condition in your network.…
How to fix incompatible JVM issue while installing Eclipse While installing Eclipse in windows, got one error like above and unable to proceed with the installation. This video describes how to successfully install Eclipse. How to solve incompa…
Suggested Courses
Course of the Month7 days, 23 hours left to enroll

765 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