[comp.mail.mh] xbiff with automagic-incing

mark@uxa.cso.uiuc.edu (10/23/90)

I am using mh and am usually logging in from an xterminal.
I have my mail automagically inc-ed using .forward and  .maildelivery
(thanks to this notesfile)

Anyone out there care to share with me how you would use xbiff to
monitor ~/mail/mh/1, to consider it true?  If the file dne, my xbiff
breaks down and never shows up (I guess it wants a file of length 0??)

Any help greatly appreciated! 


--------------------------------------------------------------
Mark Rendina               "There's nothin' wong, it just dodn wook"
mark@uxa.cso.uiuc.edu 	          - What I learned at Fermilab
University of Illinois       

ziegast@ENG.UMD.EDU (Eric Ziegast) (10/25/90)

Mark writes:
>I am using mh and am usually logging in from an xterminal.
>I have my mail automagically inc-ed using .forward and  .maildelivery
>(thanks to this notesfile)
>
>Anyone out there care to share with me how you would use xbiff to
>monitor ~/mail/mh/1, to consider it true?  If the file dne, my xbiff
>breaks down and never shows up (I guess it wants a file of length 0??)

The method I used in my last message "should" work.  I haven't tested
it, though. I'll try it tomorrow and see what happens. (I can't do much
with a VT100 form home.)
________________________________________________________________________
Eric W. Ziegast, University of Merryland, Engineering Computing Services
ziegast@eng.umd.edu - Eric@[301.405.3689]

mcgrew@ichthous.Eng.Sun.COM (Darin McGrew) (10/26/90)

In article <72800001@uxa.cso.uiuc.edu> mark@uxa.cso.uiuc.edu writes:
>I am using mh and am usually logging in from an xterminal.
>I have my mail automagically inc-ed using .forward and  .maildelivery
>(thanks to this notesfile)
>
>Anyone out there care to share with me how you would use xbiff to
>monitor ~/mail/mh/1, to consider it true?  If the file dne, my xbiff
>breaks down and never shows up (I guess it wants a file of length 0??)

What I would do instead of having xbiff look at at your +inbox,
is use the checkCommand resource of xbiff to give it a command
that returns 0, 1, or 2 (new mail, no change, or mail cleared).
I've done this to teach xbiff to check both news and notes, and
it works fine.  All you have to do is supply the appropriate
checkCommand.

Darin McGrew			mcgrew@Eng.Sun.COM
Affiliation stated for identification purposes only.

jdpeek@RODAN.ACS.SYR.EDU (Jerry Peek) (10/26/90)

Darin McGrew <mcgrew@Eng.Sun.COM> wrote:
> In article <72800001@uxa.cso.uiuc.edu> mark@uxa.cso.uiuc.edu writes:
> >Anyone out there care to share with me how you would use xbiff to
> >monitor ~/mail/mh/1, to consider it true?  If the file dne, my xbiff
> >breaks down and never shows up (I guess it wants a file of length 0??)
> 
> What I would do instead of having xbiff look at at your +inbox,
> is use the checkCommand resource of xbiff to give it a command
> that returns 0, 1, or 2 (new mail, no change, or mail cleared).
> I've done this to teach xbiff to check both news and notes, and
> it works fine.  All you have to do is supply the appropriate
> checkCommand.

One easy thing to check is the inbox folder itself.  In other words, check
the directory file /<your-home-directory>/Mail/inbox.  If a new message is
added to the folder, the directory file itself will be modified.

I don't know how that would work with 'xbiff'.  But I used that trick
with the C-shell's '$mail' variable once:
	set mail = (60 /usr/spool/mail/jdpeek /etc/motd /some/directory)
and if the '/some/directory' directory was modified, the shell would say:
	New mail in /some/directory.

--Jerry Peek; Syracuse University Academic Computing Services; Syracuse, NY
  jdpeek@rodan.acs.syr.edu, JDPEEK@SUNRISE.BITNET        +1 315 443-3995

ziegast@ENG.UMD.EDU (Eric Ziegast) (10/28/90)

Jerry Peek writes:
>Darin McGrew <mcgrew@Eng.Sun.COM> wrote:
>> In article <72800001@uxa.cso.uiuc.edu> mark@uxa.cso.uiuc.edu writes:
>> >Anyone out there care to share with me how you would use xbiff to
>> >monitor ~/mail/mh/1, to consider it true?  If the file dne, my xbiff
>> >breaks down and never shows up (I guess it wants a file of length 0??)
>
>One easy thing to check is the inbox folder itself.  In other words, check
>the directory file /<your-home-directory>/Mail/inbox.  If a new message is
>added to the folder, the directory file itself will be modified.

I find out that xbiff may not work in the future using the method I used
and the one Jerry describes above.  According to our local X guru, there
are two versions of xbiff.  The first version only checks to see if the 
file size changes, or if the file is cleared.  The newer version does
checking which is more specific to /usr/ucb/Mail format.

I found this out when I tried using "xbiff -file ~/Mail/inbox/1" on two
different systems, and one worked while the other didn't.
________________________________________________________________________
Eric W. Ziegast, University of Merryland, Engineering Computing Services
ziegast@eng.umd.edu - Eric@[301.405.3689]

jch@risci.tn.cornell.edu (Jeffrey C Honig) (10/28/90)

I just thought I would throw in my 2 cents worth.  I use a wrapper
around slocal, primarily because sendmail does not grok the return
codes issued by slocal (someday I'll get around to fixing that).  A
side effect is that I can then specify the -verbose switch to slocal
and get a log of mail received into a file.  I use a sh/awk script to
scan this log and show me which folders mail was stored in.

This turns out to work very nicely with xbiff, I just point it at this
log file:

	xbiff*file:		Mail/slocal.log

I'm including my wrapper script.  Note that it uses a temporaray file
to reduce the chance of multiple invocations from jumbling the file.
I invoke it with a .forward of:

"| cd /mu/jch; bin/slocal -user jch -verbose"

I've written a program to replace the mini awk script to allow scripts
to read .mh_profile, but haven't updated this script yet.  It is
called mhparam and prints to stdout the value of any .mh_profile
entries you specify on the command line.  I'll submit it to the MH
maintainers eventually, send me e-mail if you can't wait.

Jeff


#!/bin/sh

file=/tmp/`basename ${0}`.$$
status=0
HOME=${PWD=`pwd`} export HOME
profile=${PWD-`pwd`}/.mh_profile
slocal=`mhpath +`/`/bin/awk "\\\$1 == \"Slocal-Log:\" { print \\\$2 }" ${profile}`

echo "`date`: ${0} ${*}"	> ${file} 2>&1
/usr/local/lib/mh/slocal ${*} >> ${file} 2>&1 || status=75

if [ -n ${slocal-""} ]; then
	cat ${file} >> ${slocal}
fi	

rm ${file}

exit $status

lawrence@epps.kodak.com (Scott Lawrence) (10/30/90)

In article <72800001@uxa.cso.uiuc.edu>, mark@uxa.cso.uiuc.edu writes:
> 
> Anyone out there care to share with me how you would use xbiff to
> monitor ~/mail/mh/1, to consider it true?  If the file dne, my xbiff
> breaks down and never shows up (I guess it wants a file of length 0??)
> 

I have the following in my .maildelivery:

default - | A /usr/local/lib/mh/rcvstore
* - | R /usr/local/lib/mh/mailnotice

the first causes the auto-inc, of course; the second line triggers my
mail notification script, which is appended below.  It sends a zephyr
notice and adds a line to a .biff file in my home directory (and at the
same time removes any from previous days to keep the file from growing
forever).  Then I use "xbiff -file .biff".

mailnotice:

#!/bin/sh
#
# This script expects stdin to be a mail message
#
# Send a zephyr notice Class: MAIL Instance: MH Destination: $USER
#
awk '/From:/ {print}; /Subject:/ {print} /^$/ {exit}' - | /usr/local/bin/zwrite -n -s "" -c MAIL -i MH $USER 
#
# If a .biff file exists, add a line to it; 
# this can be used by: xbiff -file .biff
# to change the state of the biff icon
#
# All the fancy stuff with the date is intended to keep the file from
# growing without limit - the date is added to the file, and then any
# dates not todays date are removed.
#
if [ -f $HOME/.biff ]; then
        date +%y%m%d%t%T | cat $HOME/.biff - | \
        awk '$1==TODAY {print}' TODAY=`date +%y%m%d` > $HOME/.biff
fi
exit 0

---
Scott Lawrence
Internet: <lawrence@epps.kodak.com>   Voice: 508-670-4023  Fax: 508-670-4033
Electronic Pre-Press Systems; 165 Lexington St. 400/165L; Billerica MA 01821
--
---
Scott Lawrence
Internet: <lawrence@epps.kodak.com>   Voice: 508-670-4023  Fax: 508-670-4033
Electronic Pre-Press Systems; 165 Lexington St. 400/165L; Billerica MA 01821