Christophe Zwecker <fw5y491(_at_)public(_dot_)uni-hamburg(_dot_)de> writes:
...
sometimes (most of the times) I get new mail with popclient. I read the
mail. Its marked read. I get new mail. I start the procmail script again.
THe old (already read) mail shows up as unread again. !!
Here my sortmail script:
#!/bin/sh
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
Could formail not be returning success for some reason? (I'd also
suggest checking the return code of lockfile when locking the
mailbox.) If you replace the formail line to the end with:
if formail -s procmail <.newmail; then
rm -f .newmail
else
echo "formail failed: return code $?"
rm -f .newmail.lock
exit 1
fi
rm -f .newmail
fi
exit 0
then at least you'll know what formail returned so you can track down
what's up if that's the problem.
Philip Guenther