I was trying to setup my crontab to notify me of unconfirmed pending mail,
but I only wanted to receive the email when once for each email (I know
that's the -C option), but I also only want an email sent if their is any
pending email.  Right now if I use

tmda-pending -CbsO 2d | mail -s "TMDA pending" sentinel > /dev/null

I still get an empty email when no pending mail exists.  So I figured I'd
drop it into an if statement and use the -p flag to when checking for mail
ready for reporting:

if (tmda-pending -CpbsO 2d | grep . > /dev/null) then (
    tmda-pending -CbsO 2d|mail -s "TMDA pending" sentinel
) fi

The only problem with this was that the -C and -p flags didn't play well
together.  The reported pending mail still got cached by the first
tmda-pending call that was supposed to be pretending, so the only email I
would get was an empty email if I had any previously uncached and
unconfirmed email.

My next thought was to use the -O and -Y flags without the -C flag in my
test as follows:

if (tmda-pending -bsO 2d -Y 3d | grep . > /dev/null) then (
    tmda-pending -CbsO 2d|mail -s "TMDA pending" sentinel
) fi

Not as graceful as the first option would have been, but doable, except that
the -O and -Y flags didn't play well together.  In .69 the test returns no
matches (I think that in .68 I got back the -O matches).  Ideally I'd
like -O 1d -Y 2d to return the messages the fall in-between and optionally
for -Y 1d -O 2d return everything but the messages between the two.

Since neither of these solutions worked I'm using this kluge:

if (tmda-pending -TbO 2d|awk '{print $1}' | tmda-pending -TbY 3d -|grep . >
/dev/null) then (
    tmda-pending -CbsO 2d|mail -s "TMDA pending" sentinel > /dev/null
) fi

While this is actually working for me I really would have preferred either
of the two prior solutions to have worked, such that when I use -Cp I only
see messages that have not been cached, but the displayed messages do not
get cached, and -O in combination with -Y operates as noted above.

Dave

_____________________________________________
tmda-users mailing list ([EMAIL PROTECTED])
http://tmda.net/lists/listinfo/tmda-users

Reply via email to