Solved

Updating mailbox files.

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

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

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…
Using libpcap/Jpcap to capture and send packets on Solaris version (10/11) Library used: 1.      Libpcap (http://www.tcpdump.org) Version 1.2 2.      Jpcap(http://netresearch.ics.uci.edu/kfujii/Jpcap/doc/index.html) Version 0.6 Prerequisite: 1.      GCC …
Learn how to find files with the shell using the find and locate commands. Use locate to find a needle in a haystack.: With locate, check if the file still exists.: Use find to get the actual location of the file.:
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…

710 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