andrew@calvin.doc.ca (Andrew Patrick) (03/05/91)
First, I am running version 7.2.0 on a Sun (OS 4.0.3c) mostly using
tool mode.
I am looking at a script that automatically sorts my incoming mail from
various mailing lists and puts it into different folders. This script
is called from my .forward file using:
"|~/bin/sortmail andrew"
The important parts of the script does the following:
- the body of the message is stored in the file $MSGTMP
- if a mailing list is recognized, the destination folder is stored in
variable $box
- then the message is filed using:
cat $MSGTMP >> $box
echo Filed to $box >> $logfile
- if no mailing lists are found, then the variable $box is set to
/usr/spool/mail/$user
cat $MSGTMP >> $box
echo Not classified, filed to $box >> $logfile
It seems to me that this script defeats all file locking and could be
very dangerous. For example, if I am reading and updating a folder for
a mailing list while new messages are coming into that folder.
My questions are:
- is this method as dangerous as it appears?
- is there a way to use file locking to avoid the dangers?
- is there a better way to have your mail sorted throughout the day?
- I know how to use 'pick' to sort mail once it is in the spool
area, and I know I could run the sort each time Mush is
started, but I would like to run Mush in tool mode all day and
still only see non-mailing-list mail as it comes in.
--
Andrew Patrick, Ph.D. Department of Communications, Ottawa, CANADA
andrew@calvin.doc.CA
"The interface IS the program."