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

Re: [leafnode-list] Fetchnews and Shell Script




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

>cd /var/spool/news/out.going
> if == ? then fetchnews -P
> fi


You can try something like this:

#!/bin/sh
cd /var/spool/news/out.going
COUNT=`ls | wc -w`
if test $COUNT -gt 0; then
    fetchnews -P
fi

The third line (COUNT=...) uses ls and wc to count the number
of files in the directory, and back-quote (``) substitution
to assign it to the variable COUNT.

The command "test" handles logical tests such as comparison, etc.

Actually, I think there is quite a lot of leafnode
functionality that could be pushed up to the script
(shell or otherwise) level.  When I get to work on
Monday I will post my leafnode wrapper which adjusts
the contents of the interesting.groups directory.

I was having problems with a super-slow link (China-Texas)
and would have a big headache when I accidentally entered
a group that I didn't want to download.  The wrapper script
can use either command line arguments (download these newsgroups
directly), a pre-defined file (these are the groups I'm really
interested in), or the contents of a particular user's .newsrc
file (dowload every group he is subscribed to).

Hope this helps,
Mark.

--
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