Solved

Updating mailbox files.

Posted on 1999-01-28
1
213 Views
Last Modified: 2010-04-21
I am using AIX 3.2.5 and have a number of users who do not update their mail files.  This leaves the files filled with deleted messages which take up space.  Is there a utility that will update all mail files in a directory?  Currenly, when the var filesystem starts getting to full, I just go in and log in as whichever user has the largest mailbox and update.  This can be very time consuming though.  Any help would be appreciated.
0
Comment
Question by:lcoombes
1 Comment
 
LVL 3

Accepted Solution

by:
mliberi earned 100 total points
ID: 2009443
I'm not really sure to fully understand your question.

How is it possible that the files remains filled with DELETED messages? When you delete a message it get phisically removed from the /var/spool/mail/$user file.

When the user READ the mail message without DELETING it, mail command move the message to $HOME/mbox file.

So if you experience that the /var/spool/mail/$user file grows the problem is that the user doesn't READ the mail.

If you want to empty the incoming mail box for a given user without deleting messages you can use the following:

su - $user /tmp/readmail.ksh >/dev/null 2>&1

the command may also be automatically executed by putting it in the root's crontab file.

#!/bin/ksh
# /tmp/readmail.ksh
# move all new mail to personal $HOME/mbox file
while mail -e
do
  mail <<EOF
n
EOF
done >/dev/null 2>&1
exit


If you want to do the job for all the users do the following

for f in /var/spool/mail/*
do
  test -f "$f" || continue
  su - $f /tmp/readmail.ksh >/dev/null 2>&1
done

If users do not read their mail the next problem you'll have is that the $HOME/mbox file grows.
0

Featured Post

Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

Question has a verified solution.

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

Attention: This article will no longer be maintained. If you have any questions, please feel free to mail me. jgh@FreeBSD.org Please see http://www.freebsd.org/doc/en_US.ISO8859-1/articles/freebsd-update-server/ for the updated article. It is avail…
I have been running these systems for a few years now and I am just very happy with them.   I just wanted to share the manual that I have created for upgrades and other things.  Oooh yes! FreeBSD makes me happy (as a server), no maintenance and I al…
Learn how to navigate the file tree with the shell. Use pwd to print the current working directory: Use ls to list a directory's contents: Use cd to change to a new directory: Use wildcards instead of typing out long directory names: Use ../ to move…
In a previous video, we went over how to export a DynamoDB table into Amazon S3.  In this video, we show how to load the export from S3 into a DynamoDB table.

815 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

8 Experts available now in Live!

Get 1:1 Help Now