Sucknews

From Wikislax

Revision as of 07:54, 8 July 2012 by WikiSysop (Talk | contribs)
Jump to: navigation, search

Contents

What is Sucknews ?

Sucknews affords getting the newsfeeds over a regular NNTP connection with your Internet Service Provider. This comes in handy when you are not a big company and have no agreements with peer Newsgroup servers ;-).

Installing Sucknews

There was a time when sucknews was available from sucknews.org but this site has disappeared and there seems to be no obvious source of sucknews update software so we'll stick with an old version (perfectly satisfactory anyway). Untar and install as below :

# tar -C /usr/local -xvf suck-x.y.z.tar.gz
# cd /usr/local
# chown -R root:root suck-x.y.z.tar.gz
# cd suck-x.y.z.tar.gz
# ./configure --help | less
# ./configure --prefix=/usr/local/news --libdir=/usr/local/news/lib64 --mandir=/usr/local/man \
--with-inn-lib=/usr/local/news/lib --with-inn-include=/usr/local/news/include --with-perl-exe=/usr/bin
# make
# make install
# make clean
# cd /usr/local/news/bin
# chown news:news lmove rpost suck testhost

Running Sucknews

The below script affords posting the local messages and get entering messages on your Internet Service Provider site :

#!/bin/sh

NNTP_SERVER=news.free.fr
NEWS_PATH=/usr/local/news
BIN_PATH=/usr/local/news/bin
SUCK_PATH=/usr/local/news/bin
BATCH_PATH=/usr/local/news/spool/outgoing/free
FILTER_PATH=$SUCK_PATH/filter.sh

cd $SUCK_PATH

######################################################
# posting outgoing articles (localhost->NNTP_SERVER) #
######################################################

echo "Sending articles..."
if test -s $BATCH_PATH
then
$BIN_PATH/rpost $NNTP_SERVER -b $BATCH_PATH \
    -f $FILTER_PATH \$\$o=/tmp/filtered \$\$i /tmp/filtered
else
    echo "No articles to post..."
fi

######################################################
# getting incoming articles (NNTP_SERVER->localhost) #
######################################################

echo Getting articles...
if [ -e /tmp/newposts ]; then
    rm /tmp/newposts
fi
$BIN_PATH/suck $NNTP_SERVER -AL $NEWS_PATH/db/active -i 0 -n -H -K -br /tmp/newposts -c
if [ -e /tmp/newposts ]; then
    $BIN_PATH/rnews /tmp/newposts
fi
cat /dev/null > $BATCH_PATH

In the first part, messages are posted to the provider using rpost. The list of articles is obtained from the information contained in newsfeed file /usr/local/news/spool/outgoing/free. The -f option affords applying a filter to the messages so as to expurge certain headers :

#!/bin/sh
/usr/local/news/bin/sm -R $1 | sed -e "/^X-Trace/d" -e "/^NNTP-Posting-Host/d" \
-e "/^Xref/d" -e "/^X-Complaints-To/d" -e "/^NNTP-Posting-Date/d" > $2

In the second part, suck gets the messages from your Internet Service Provider. The -AL option affords using the list of groups defined. -i 0 indicates that there is no limit on the number of messages to get, -n is for the mode « messages identified by their numbers by the provider » -c is to update the numbers after the end of the operation, -br defines the output file, -H and -K afford skipping the historic and killfile options. The file written is afterwards used by rnews. The articles are then available.

Automating Sucknews

Automate Sucknews execution using crontab. In the example below, suck.sh is executed every 10 minutes :

# su news
$ crontab -e
# MIN HOUR DAY MONTH DAYOFWEEK COMMAND
00 13 * * * /usr/local/news/bin/suck.sh
30 13 * * * /usr/local/news/bin/news.daily expireover lowmark


INN Main Page Asterisk
Personal tools
Namespaces
Variants
Actions
Navigation
Toolbox