On Tue, 16 Nov 1999 12:02:04 +1300 (NZDT), Volker Kuhlmann
<kuhlmav(_at_)elec(_dot_)canterbury(_dot_)ac(_dot_)nz> wrote:
You don't need cron, just outsmart the sysop with something like this,
run each time you log in or out:
#!/bin/tcsh -f
(Ugh.)
The real problem is to remove msgs piped into procmail from your
mail spool file in a way which doesn't lose anything... (perhaps
lockfile will help - I think I never had much luck in getting it to
go)
Actually the "crontab" example in the NOTES section of the procmail(1)
manual page is supposed to solve exactly that. You can run it in a
while loop like you demonstrated just as well as from a crontab entry
or an at job.
Quoted below for our lazy friends. Do note that ORGMAIL is system
specific; you'll have to check your version of the manual page or do
some other sort of (gasp!) research to figure out what's right for
your system.
Hope this helps,
/* era */
Procmail can also be invoked to postprocess an already filled system
mailbox. This can be useful if you don't want to or can't use a
$HOME/.forward file (in which case the following script could
periodically be called from within cron(1), or whenever you start
reading mail):
#!/bin/sh
# Remove this line when you understand what it means; see comment above
echo "You need to change the ORGMAIL setting in this script"; exit 1
ORGMAIL=/usr/spool/mail/$LOGNAME
if cd $HOME &&
test -s $ORGMAIL &&
lockfile -r0 -l3600 .newmail.lock 2>/dev/null
then
trap "rm -f .newmail.lock" 1 2 3 15
umask 077
lockfile -l3600 -ml
cat $ORGMAIL >>.newmail &&
cat /dev/null >$ORGMAIL
lockfile -mu
formail -s procmail <.newmail &&
rm -f .newmail
rm -f .newmail.lock
fi
exit 0
--
Too much to say to fit into this .signature anyway: <http://www.iki.fi/era/>
Fight spam in Europe: <http://www.euro.cauce.org/> * Sign the EU petition