Solved

Updating mailbox files.

Posted on 1999-01-28
1
215 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

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

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

Hello fellow BSD lovers, I've created a patch process for patching openjdk6 for BSD (FreeBSD specifically), although I tried to keep all BSD versions in mind when creating my patch. Welcome to OpenJDK6 on BSD First let me start with a little …
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…
Learn how to get help with Linux/Unix bash shell commands. Use help to read help documents for built in bash shell commands.: Use man to interface with the online reference manuals for shell commands.: Use man to search man pages for unknown command…
This video shows how to set up a shell script to accept a positional parameter when called, pass that to a SQL script, accept the output from the statement back and then manipulate it in the Shell.

856 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