Sucknews

From Wikislax

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 :

# su news
$ cd /usr/local/news/bin
$ vi suck.sh
i
#!/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
<esc>
:x
$ chmod u+x suck.sh
$ ./suck.sh
Sending articles...
No articles to post...
Getting articles...
Attempting to connect to news.free.fr
Using Port 119
Official host name: news.free.fr
Address: 212.27.60.38
Address: 212.27.60.39
Address: 212.27.60.37
Address: 212.27.60.40
Connected to news.free.fr
200 news-4.free.fr (4-2) NNRP Service Ready - newsmaster@proxad.net (posting ok)
No sucknewsrc to read, creating
Adding new groups from local active file to sucknewsrc
New Group - adding to sucknewsrc: control
control - 1 articles 3983-3983
New Group - adding to sucknewsrc: control.cancel
control.cancel - 349 articles 94271852-94272200
New Group - adding to sucknewsrc: control.checkgroups
control.checkgroups - 4 articles 5228-5231
New Group - adding to sucknewsrc: control.newgroup
control.newgroup - 1 articles 73186-73186
New Group - adding to sucknewsrc: control.rmgroup
control.rmgroup - 1 articles 30996-30996
New Group - adding to sucknewsrc: junk
junk - 1 articles 38322-38322
New Group - adding to sucknewsrc: alt.os.linux.slackware
alt.os.linux.slackware - 1907 articles 231211-233117
Elapsed Time = 0 mins 0.72 seconds
2227 Articles to download
Deduping Elapsed Time = 0 mins 0.00 seconds
Deduped, 2227 items remaining, 0 dupes removed.
Total articles to download: 2227
5290946 Bytes received in 1 mins 20.79 secs, BPS = 65489.2
Closed connection to news.free.fr
Building RNews Batch File(s)
Cleaning up after myself
news@inner:/usr/local/news/bin$
<ctrl>d
#

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 at 13:00 daily :

# 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