[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[leafnode-list] here is my fetch wrapper



As promised, here is my fetch wrapper.  It solves some of the
problems you can have with automated fetching (such as accidentally
looking at big groups and having them fetched over a slow link).
It's also good when you want to view messages in a specific
newsgroup first, and download the rest later.

I think this shows some of the advantages of the split-level
model of programming.  Leafnode does a great job of transferring
the files, serving the nntp port, etc., but administrative tasks
such as this are a lot easier to do at the higher level of shell
scripts (or other vhll's... I like Tcl, myself).

Share and enjoy!
Mark

#!/bin/sh
#-----------------------------------------------------------------------
#
# dofetch -- add some special processing to fetch
#
# Fetchnews normally works in an automatic manner, fetching
# groups which have been recently requested by users.
#
# This shell script provides a bit more control over what is
# fetched.  It can either
#    1.  fetch groups in a pre-specified file
#    2.  fetch groups based on a particular user's .newsrc file
#    3.  fetch groups on the command line
#
# License as per leafnode, share and enjoy!
# Mark Harrison, markh@xxxxxxxxxxxxxxxxx
#-----------------------------------------------------------------------

#-----------------------------------------------------------------------
# First clean things up.  This is not strictly necessary, but
# it's convenient in many cases.
#./texpire

#-----------------------------------------------------------------------
# 1.  Hardcoded list.  Put the newsgroups list, one per line,
#     in the file "my.interesting.newsgroups"

groups=`cat my.interesting.newsgroups`

#-----------------------------------------------------------------------
# 2.  Newsrc.  Put the path to your own newsrc file below.
#     *** comment this out if you use method 1 ***

RCFILE=/home/markh/.newsrc
groups=`grep : $RCFILE | sed s/:.*//`

#-----------------------------------------------------------------------
# 3.  Command line.  If a list of newsgroups is given on the
#     command line, just fetch those newsgroups.

if test $# -ne 0; then
    groups=$*
    echo fetching only groups: $groups
fi

#-----------------------------------------------------------------------
# Now that we have the newsgroup list, zap entries in the
# interesting.groups directory, repopulate the directory,
# and fetch news as usual.

rm -f /var/spool/news/interesting.groups/*
for i in $groups;do
    touch /var/spool/news/interesting.groups/$i
done
/fetchnews -vvv

--
Mark Harrison                         http://usai.asiainfo.com:8080/
AsiaInfo Computer Networks            markh@xxxxxxxxxxxxxxxxx
Beijing, China / Santa Clara, CA      http://www.markharrison.net/



-- 
leafnode-list@xxxxxxxxxxxxxxxxxxxxxxxxxxxx -- mailing list for leafnode
To unsubscribe, send mail with "unsubscribe" in the subject to the list