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

x
?
Solved

Check file size of /var/spool/mail files

Posted on 2004-09-30
6
Medium Priority
?
426 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
Learn Veeam advantages over legacy backup

Every day, more and more legacy backup customers switch to Veeam. Technologies designed for the client-server era cannot restore any IT service running in the hybrid cloud within seconds. Learn top Veeam advantages over legacy backup and get Veeam for the price of your renewal

 
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

Enroll in October's Free Course of the Month

Do you work with and analyze data? Enroll in October's Course of the Month for 7+ hours of SQL training, allowing you to quickly and efficiently store or retrieve data. It's free for Premium Members, Team Accounts, and Qualified Experts!

Question has a verified solution.

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

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…
The purpose of this article is to demonstrate how we can upgrade Python from version 2.7.6 to Python 2.7.10 on the Linux Mint operating system. I am using an Oracle Virtual Box where I have installed Linux Mint operating system version 17.2. Once yo…
This course is ideal for IT System Administrators working with VMware vSphere and its associated products in their company infrastructure. This course teaches you how to install and maintain this virtualization technology to store data, prevent vuln…
Video by: ITPro.TV
In this episode Don builds upon the troubleshooting techniques by demonstrating how to properly monitor a vSphere deployment to detect problems before they occur. He begins the show using tools found within the vSphere suite as ends the show demonst…
Suggested Courses

618 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