[news.admin] C news shell script questions

reid@wrl.dec.com (Brian Reid) (09/04/90)

What code can I put in a shell script that will determine that a site is
running C news?

Given that I have determined that a site is running C news, is there some way
I can determine which article numbers are unexpired, other than the obvious
and time-consuming hack of looking in the spool directory?

I am asking these questions so that I can formulate a version of arbitron
that works with C news; enough sites are running it these days that the
arbitron results are becoming skewed by the wrong answers produced by the
current script on C news.

Brian

henry@zoo.toronto.edu (Henry Spencer) (09/04/90)

In article <1990Sep4.144525.7423@wrl.dec.com> reid@wrl.dec.com (Brian Reid) writes:
>What code can I put in a shell script that will determine that a site is
>running C news?

Hmm.  Aside from the obvious question of knowing where the news directories
are, it should not be too hard.  One reasonable approach would be to look
for /usr/lib/news/mailname, a file that is normally a required part of
C News (it's used to generate From: lines in inews) and doesn't exist in
B News that I know of.

>Given that I have determined that a site is running C news, is there some way
>I can determine which article numbers are unexpired, other than the obvious
>and time-consuming hack of looking in the spool directory?

There is no way to determine what article numbers are unexpired other than
looking in the spool directory, not if you want precise results.  Looking
at min/max in the active file gives you only a crude approximation, since
a precise answer requires a list or a bitmap, not just a pair of numbers.

If all you want is a crude approximation, encourage C News sites that use
arbitron to run upact or updatemin regularly.  The programs are in our
distribution, although at the moment we don't specifically suggest regular
runs.  That will probably change.
-- 
TCP/IP: handling tomorrow's loads today| Henry Spencer at U of Toronto Zoology
OSI: handling yesterday's loads someday|  henry@zoo.toronto.edu   utzoo!henry

vixie@wrl.dec.com (Paul Vixie) (09/05/90)

[ -f /usr/lib/news/explist ] && {
	echo cnews
}
--
Paul Vixie
DEC Western Research Lab	<vixie@wrl.dec.com>
Palo Alto, California		...!decwrl!vixie

ronald@robobar.co.uk (Ronald S H Khoo) (09/06/90)

In article <1990Sep4.165941.26080@zoo.toronto.edu> henry@zoo.toronto.edu (Henry Spencer) writes:

> If all you want is a crude approximation, encourage C News sites that use
> arbitron to run upact or updatemin regularly.  

What about putting something like

if test -x $NEWSBIN/expire/updatemin ; then
	$NEWSBIN/expire/updatemin
fi

(yeah, then look for upact as well, I s'pose) in the arbitron script ?
Updatemin's cheap and fast.  No reason not to run it only in arbitron
if you don't want to run it otherwise. [ triple negative, yuck :-) ]

Though being as cheap as it is, I run it anyway.  Why not ? :-)

-- 
my .signature is on holiday.

woods@eci386.uucp (Greg A. Woods) (09/07/90)

In article <1990Sep4.165941.26080@zoo.toronto.edu> henry@zoo.toronto.edu (Henry Spencer) writes:
> In article <1990Sep4.144525.7423@wrl.dec.com> reid@wrl.dec.com (Brian Reid) writes:
> >What code can I put in a shell script that will determine that a site is
> >running C news?
> 
> Hmm.  Aside from the obvious question of knowing where the news directories
> are, it should not be too hard.  One reasonable approach would be to look
> for /usr/lib/news/mailname, a file that is normally a required part of
> C News (it's used to generate From: lines in inews) and doesn't exist in
> B News that I know of.

Personally I'd prefer it if the file used for such identification was
either one used by both the C programmes and shell scripts, or else
one common enough to be consistent on many sites.

Paul Vixie's suggestion of explist would be bad for several sites I
know of, where doexpire has been modified to use a succession of files
in explist.d.

I don't know how many people have changed inews enough to invalidate
Henry's choice of mailname, but even if the number is zero, my
reasoning should still hold.

How about "/usr/lib/news"/bin/config?  Or maybe "/usr/lib"/newsbin?

I would say the biggest problem will be finding the news directories.
The only way we've done that is by looking in several obvious places,
with a preferred order.  That still won't work for sites that have so
little imagination that they mount partitions on places like
"/usr2/lib/news".  You can probably try these in the given order:
	/usr/lib/news		(the de-facto standard way)
	/usr/local/lib/news	(my preference)
	/usr/local/news		(quite common in my experience)
	/local/lib/news		(quite common too, and my second choice)
	/local/news
	/var/lib/news		(though these are usually just symlinks)
	/var/news
though I'm sure there are many more possibilites than one can list.
-- 
						Greg A. Woods

woods@{eci386,gate,robohack,ontmoh,tmsoft}.UUCP
+1-416-443-1734 [h]  +1-416-595-5425 [w]    VE3-TCP	Toronto, Ontario CANADA