There's a little ;) script I wrote, that allows pulling news
from one of several servers, catching up all the other. All info is
inside...
I wrote it in a bit rush and tested it quite shortly, so if
you find any errors, please write me... ;)
OK, here it goes:
//----- multi (remember to make it executable: chmod o+x multi)
#!/bin/sh
# Be sure to customize lines 74 and 93 according to your needs!
# This script uses certain unix programs, be sure they're in your
# path or you might run into trouble!
# The programs used are: awk, zip, grep, tin (this catches up other
# newsservers, if you don't have it, use trn with appropriate options
# instead)
# This script doesn't solve certain problems (eg. when you're
# subscribed to different newsgroups on different servers you _WILL_
# loose articles). Be sure you are subscribed to exactly the same
# groups on all servers.
# This script uses .newsrc.host.domain files as newsrc files, you
# need to create them by hand. These files are also used to
# determine, which servers you use. If you have files like:
# .newsrc.news_1.my.domain
# .newsrc.news_2.his.domain
# .newsrc.news_3.theird.domain
# it means, you use servers news_1.my.domain news_2.his.domain and
# news_3.their.domain
# And finally - syntax for this script (let me call it 'multi', ok?)
# It goes like this: multi <host.domain>
# the file .newsrc.host.domain and the server host.domain will be
# used to pull news; all other servers (their names are derived from
# the .newsrc.[...] files) will be caught up.
#----------------------------------------------------------------------------
# First of all, we need to check if we actually have the
# .newsrc.host.domain file we want to use.
if [ ! -f $HOME/.newsrc.$1 ]
then
echo $HOME/.newsrc.$1 not found!
exit 1
fi
# Now, let's do what we want, using specified NNTP host
# step 1: ensure, there's no old packet:
if [ -f $HOME/mailnews.zip ]
then
echo "mailnews.zip found in home directory.."
echo "Ensure you've already downloaded it, delete it and run 'multi' again."
exit 2
fi
# step 2: make a temporary directory to process soup packet.
# warning: this script deletes any files found in ~/uqwk.temp.mailnews.dir
# before creating new packet. Be sure you don't use this directory for
# any other purpose
if [ ! -d $HOME/uqwk.temp.mailnews.dir ]
then
mkdir $HOME/uqwk.temp.mailnews.dir
else
rm -rf $HOME/uqwk.temp.mailnews.dir/*
fi
# step 3: we need to catch up any other .newsrc files
# if we do it _before_ pulling news, there is less risk, we loose
# articles.
for server_name in `ls -A | grep '^.newsrc.' | awk '{print substr($0, 9)}'`
do
if [ ! _$server_name = _$1 ]
then
NNTPSERVER=$server_name
export NNTPSERVER
echo Catching up: tin -r -c -f$HOME/.newsrc.$server_name
tin -r -c -f$HOME/.newsrc.$server_name
fi
done
# step 4: now it's time to create the packet.
NNTPSERVER=$1
UQ_HOME_DIR=$HOME/uqwk.temp.mailnews.dir
UQ_NRC_FILE=$HOME/.newsrc.$1
export NNTPSERVER UQ_HOME_DIR UQ_NRC_FILE
echo Creating packet using:
echo NNTPSERVER: $NNTPSERVER
echo HOME DIR: $UQ_HOME_DIR
echo NEWSRC FILE: $UQ_NRC_FILE
# customize the following line according to your needs:
uqwk -m +n +L -B0 +x
zip -9 -m -j $HOME/mailnews.zip $UQ_HOME_DIR/*.MSG $UQ_HOME_DIR/AREAS
# step 5: we're done... let's just delete the temporary directory
# we created at startup.
rm -rf $UQ_HOME_DIR
echo All done.
//-----
Well, that's about it.
Take care,
--Lukasz Grochal