Re: Usenet server test script
"Theo v. Werkhoven" <theo@van-werkhoven.nl.invalid> wrote:
>Sure there is.
>$telnet news.xs4all.nl 119
>Trying 194.109.133.242...
>Connected to news.xs4all.nl.
>Escape character is '^]'.
>200 news.xs4all.nl NNRP Service Ready (posting ok).
>article <l3kr14d2fhvghmla9rdh0ia12cupsq2fqs@4ax.com> /* my command */
>220 0 <l3kr14d2fhvghmla9rdh0ia12cupsq2fqs@4ax.com> article
>Path: news.xs4all.nl!newsspool.news.xs4all.nl!newsfeed.x s4all.nl...
>...
>With 'article' you get the post with the requested Message-ID.
>Now write a little expect script and you're done.
Thanks for the reply. I've installed tcp and expect, but I find the
expect manpage to be hard reading. I've managed to get it to display a
post, although I don't really know how to separate the server messages
from the post. The "interact" tells it to display everything, and it
does exit without user intervention, but I'm sure there's a neater way.
#!/usr/bin/expect -f
spawn telnet aioe.cjb.net 119
sleep 1
send "article <0123456789abcdef@foo.invalid>\r"
sleep 1
send "quit\r"
interact
I might look into trying something similar to the above, but using bash
pipes rather than with expect.
I also figured how to use "suck" to get a message by its Message-ID. This
script reads a message from a public newsserver and saves it as the file
"feedback.txt". (It also uses 3 temporary files in the local dir.)
#!/bin/bash
echo "alt.test -1 0" >sucknewsrc
echo "<0123456789abcdef@foo.invalid>" >suckothermsgs
suck aioe.cjb.net >feedback.txt
rm -f sucknewsrc suck.newrc suckothermsgs
|