[news.admin] inpaths

tale@pawl.rpi.edu (David C Lawrence) (09/24/89)

In the head of inpaths.c there is the following [abbreviated] comment:

/* Run it like this:
 *
 *  find . -type f -print | inpaths "yourhost" | mail pathsurvey@decwrl.dec.com
 *
 * If you have some other way of generating a list of news file
 * names, such as running a script over the history file, you can use that
 * instead. Inpaths handles crossposting regardless of which technique
 * you use.
 */

Well, I really dislike the idea of sending our diskheads seeking all
over the place when it can be avoided, so I wrote a short script,
"doinpaths", to handle it.  I invoke it from cron on the twenty-third
of each month.  Two versions are presented here, one for C News and
one for B News.  It saves quite a bit of resource by avoiding the
find; I hope someone else finds it useful.  Yes, it is terribly simple
-- then again, I have a feeling that a lot of people just look at the
comment from inpaths.c and say, "Okay, find . it is ..."

Aside to Brian Reid: sorry about the two bogus messages last night.
:-)  They weren't from the script, but from the cron pipeline I used
to have that left out an important step.

----begin C News doinpaths----
#! /bin/sh
# A simple script to set up the input for inpaths before running it.
# The only thing that probably needs to be changed is this first line
# about where to find the config file by default.
# 23 Sep 89 -- tale@pawl.rpi.edu

# =()<. ${NEWSCONFIG}-@<NEWSCONFIG>@}>()=
. ${NEWSCONFIG-/usenet/bin.server/config}

PATH=$NEWSCTL/bin:$NEWSBIN/etc:$NEWSPATH
PATHSURVEY=pathsurvey@decwrl.dec.com,$NEWSMASTER

NL='\
'
cd $NEWSARTS
# Hard tab for cut delimiter
cut -f3- "-d	" $NEWSCTL/history | # Grab the article names
    sed -e '/^$/d' -e y:.:/: -e "s/ /$NL/g" | # list pathnames, one per line
    inpaths `cat $NEWSCTL/server` | mail $PATHSURVEY 
----end C News doinpaths----
----begin B News doinpaths----
#! /bin/sh
# A simple script to set up the input for inpaths before running it.    
# It should work just fine for B News when the following batch of variables
# is set for your system.
# 23 Sep 89 -- tale@pawl.rpi.edu

PATH=/bin:/usr/bin:/usenet/bin.server/etc
NEWSARTS=/usenet/spool
NEWSMASTER=/usenet
NEWSCTL=/usenet/lib
NEWSHOST=rpi
PATHSURVEY=pathsurvey@decwrl.dec.com,$NEWSMASTER

NL='\
'

cd $NEWSARTS
# Hard tab for cut delimiter
cut -f3- "-d	" $NEWSCTL/history | # Grab the article names
    sed -e '/^$/d' -e y:.:/: -e "s/ /$NL/g" | # list pathnames, one per line
    inpaths $NEWSHOST | mail $PATHSURVEY 
----end B News doinpaths----

len@netsys.netsys.COM (Len Rose) (09/24/89)

Why go through all of that when you can do it far easier by
having a list of all articles placed in ~spool/batch/survey
and then just running a short shell script via cron..

I think it was Rich Salz who pointed this out some time ago.


~lib/news/sys

#######################################################################
# Brian's new survey
survey:\
	all,!local:F:/usr2/spool/batch/survey
#######################################################################


# Process Brian Reid's new path report
BATCHDIR=/usr2/spool/batch
INSPATH=/usr2/bin/inspath
SITE=netsys
WORK=survey.work
INPUT=survey
OUTPUT=/usr2/tmp/inspath.out
MAILER=/bin/mail
cd $BATCHDIR
/bin/touch $WORK
/bin/cat $INPUT >> $WORK
cp /dev/null $INPUT
$INSPATH $SITE <$WORK> $OUTPUT
$MAILER pathsurvey@decwrl.dec.com news < $OUTPUT
/bin/rm -f $WORK $OUTPUT

tale@pawl.rpi.edu (David C Lawrence) (09/25/89)

In <16431@netsys.netsys.COM> len@netsys.netsys.COM (Len Rose) writes:
Len> Why go through all of that when you can do it far easier by
Len> having a list of all articles placed in ~spool/batch/survey
Len> and then just running a short shell script via cron..

"all of that"?  Did you even _glance_ at what it was doing?  Or the
use of the word "simple" three or four times?

"short shell script via cron"?  That's all it is!

"far easier"?  The little script I provided didn't even require a sys
file entry.  What's more, inpaths run by it won't spend a lot of time
getting back ENOENTs because of files which have been expired.  Most
sites don't keep news around for a whole month.  I also hate having
files, especially _huge_ files, sitting around when I don't need them.
Over the course of one month by that method, batch/survey would grow
to many, many megabytes.

Now I'm not saying that anyone other than me should even bother using
it, but please don't just throw phrases like that at what someone is
trying to contribute without even seeing what they've done.

Dave
--
 (setq mail '("tale@pawl.rpi.edu" "tale@itsgw.rpi.edu" "tale@rpitsmts.bitnet"))

len@netsys.netsys.COM (Len Rose) (09/26/89)

Don't take things so seriously.. You'll have a seizure someday.

Let's see.. it's the 26th of the month, and the survey file is
a whopping 1.39 meg , which is about half as big as our history
file.. I'd rather trade file system space for disk thrashing any
day.. 

Don't forget to take your blood pressure medicine.

Len