Thread View: news.software.nntp
6 messages
6 total messages
Started by Mark H. Weber
Fri, 20 Mar 1992 22:27
Re: Need help on installing c-news
Author: Mark H. Weber
Date: Fri, 20 Mar 1992 22:27
Date: Fri, 20 Mar 1992 22:27
251 lines
9122 bytes
9122 bytes
In article <nilsht.61@sofus.dhhalden.no> nilsht@sofus.dhhalden.no (NILS HENRIK TVETENE) writes:
>I've been installing c-news and nntp, and come across one problem.
>
>Well my problem is that the references are relative from /usr/spool/news,
>and not the whole path!
>
I guess it's my turn to answer this one. I asked this same question
a few weeks back, here's a summary I've been meaning to post for a while.
The problem has been encountered by a number of news administrators, and
the solutions are all fairly straightforward.
You may be wondering why this change was made. The advantages of not
having the leading /usr/spool/news are smaller batch files and more
efficient access by not having to traverse the /usr/spool/news inodes
for each and every article. This is probably not very important to
a small leaf site, but to a major hub, which may send 10,000 articles
per day to 10 or more sites, the savings can be significant.
The modifications fall into 3 different areas:
1) Patch the nntpsend script - a fairly simple change can be made to
change the working directory before nntpxmit is invoked.
2) Patch nntpxmit - the nntpxmit program can be modified to add
the spool directory to the article filename before it is read.
3) Patch Cnews - the relaynews program can be modified to restore
it's former behaviour, to write the full pathname out to the
batch file.
The second and third options do not take advantage of the intended
efficiency improvement in the change to Cnews, but all 3 will get
the system working.
------------------------------%< cut here >%-----------------------------
Patches for regular nntp script (csh version, sh version changes are similar):
Here's the original:
if ( -e ${send} ) then
echo ${pname}: "[$$]" begin ${host}
time nntpxmit ${host}:${send}
echo ${pname}: "[$$]" end ${host}
endif
add the following in the "for each host" loop:
if ( -e ${send} ) then
echo ${pname}: "[$$]" begin ${host}
add line ======> cd /usr/spool/news
add ${batchdir}/ ==> time nntpxmit -d ${host}:${batchdir}/${send}
echo ${pname}: "[$$]" end ${host}
endif
------------------------------%< cut here >%-----------------------------
There is also a modified nntpsend script for use with Cnews. This script
uses the Cnews locking mechanism when working with the batch files, and
expects to find the batches in the default Cnews directory. I'll post
that in it's entirety:
#!/bin/sh
#
# nntpsend site1 ... siten
# send nntp batches to remote sites, C news style.
#
# Author: Jean-Francois Lamy, lamy@ai.utoronto.ca, 1989-06-27
#
# We assume that the file of articles to be sent is found under
# $NEWSARTS/out.going/iname/togo, where iname is the site's internet name.
# this may requre a $NEWSLIB/sys entry with an explicit location specified
# if the Usenet name differs, as in the last field of:
#
# utstat:comp,news,ut,tor,can,ont,uw,list/all:F:utstat.toronto.edu/togo
#
# A togo.next file in the site directory may contain articles left over from
# previous transmissions (we append togo to togo.next, call nntpxmit on
# togo.next and it leaves failed articles there).
# =()<. ${NEWSCONFIG-@<NEWSCONFIG>@}>()=
. ${NEWSCONFIG-/usr/lib/news/bin/config}
# we assume $NEWSBIN/nntp is where nntpxmit lives; adjust appropriately
PATH=$NEWSBIN/nntp:$NEWSCTL/bin:$NEWSBIN/batch:$NEWSBIN:$NEWSPATH
export PATH
umask $NEWSUMASK
# LOGFILE is for debugging
LOGFILE=/dev/null; export LOGFILE
pname=`basename $0`
echo ${pname}: "[$$]" begin `date` > $LOGFILE
for host in ${remotes=$*}
do
cd $NEWSARTS/out.going/$host
if test -s togo || test -s togo.next
then
# we have articles to send to $host. Lock the news system, so
# that we can be sure that "togo" does not change while we
# append it to the list of things to send out. If we don't do
# that, and relaynews is in a long batch, we could actually
# catch up with relaynews and then we would need some hairy
# stuff to deal with that.
lock="$NEWSCTL/LOCK" # lock relaynews.
ltemp="$NEWSCTL/L.$$"
echo $$ >$ltemp
trap "rm -f $ltemp ; exit 0" 0 1 2 15
while true
do
if newslock $ltemp $lock
then
trap "rm -f $ltemp $lock ; exit 0" 0 1 2 15
break
fi
sleep 30
done
# while relaynews is locked, append the articles to go to
# the togo.next file for the current site. lock current site
# until nntpxmit completes, so we can unlock relaynews asap.
nntplock="$NEWSCTL/LOCKnntpsend.$host"
if newslock $ltemp $nntplock
then
# we have togo.next all to ourselves
trap "rm -f $nntplock $ltemp $lock ; exit 0" 0 1 2 15
if test -s togo.next
then
cat togo >> togo.next 2>/dev/null
rm -f togo
else
mv -f togo togo.next
fi
# unlock news; the host's togo.next file is locked and
# won't be tampered with, so togo no longer matters.
rm -f $ltemp $lock
# perform the actual transfers.
if test -s togo.next
then
echo ${pname}: "[$$]" begin ${host} > $LOGFILE
cd /usr/spool/news
nntpxmit ${host}:$NEWSARTS/out.going/$host/togo.next > $LOGFILE
cd $NEWSARTS/out.going/$host
echo ${pname}: "[$$]" end ${host} > $LOGFILE
fi
# unlock this site.
rm -f $nntpltemp $nntplock
else
# transfer in progress, leave articles to accumulate
# in ${host} for the time being.
echo ${pname}: "[$$]" ${host} locked by "[`cat $nntplock`]" > $LOGFILE
rm -f $ltemp $lock
fi # newslock LOCK$host.nntp
fi # test -s togo ...
done
echo ${pname}: "[$$]" end `date` > $LOGFILE
------------------------------%< cut here >%-----------------------------
Patches to nntpxmit:
The patch:
*** nntpxmit.c.orig Thu Jan 16 14:39:40 1992
--- nntpxmit.c Thu Jan 16 12:39:13 1992
***************
*** 339,344 ****
--- 339,345 ----
char *mode = "r";
#endif /* FTRUNCATE */
char *msgid;
+ static char fullartpath[200];
if ((Qfp = fopen(file, mode)) == (FILE *)NULL) {
char buf[BUFSIZ];
***************
*** 380,386 ****
catchsig(interrupted);
while ((msgid = getline(Qfp, Article, sizeof(Article))) != NULL) {
! if (!sendarticle(host, Article, msgid)) {
requeue(Article, msgid);
Article[0] = '\0';
cleanup();
--- 381,391 ----
catchsig(interrupted);
while ((msgid = getline(Qfp, Article, sizeof(Article))) != NULL) {
! fullartpath[0] = '\0';
! strcat(fullartpath, SPOOLDIR);
! strcat(fullartpath, "/");
! strcat(fullartpath, Article);
! if (!sendarticle(host, fullartpath, msgid)) {
requeue(Article, msgid);
Article[0] = '\0';
cleanup();
--
------------------------------%< cut here >%-----------------------------
Patch to Cnews
edit: relay/transmit.c as follows to get full path names from Cnews.
142c142
< fullname = fullartfile(filename); /* mb 1-28-92 */
---
> fullname = artfile(filename); /* N.B.: relative path */
------------------------------%< cut here >%-----------------------------
Acknowledgements:
From: louie@sayshell.umd.edu (Louis A. Mamakos)
From: Frank Terhaar-Yonkers <fty@bizarre.rtpnc.epa.gov>
From: Tom Ivar Helbekkmo <tih@barsoom.nhh.no>
From: tale@cs.rpi.edu (David C Lawrence)
From: Jonathan I. Kamens <jik@pit-manager.MIT.EDU>
From: Kenneth Herron <kherron@ms.uky.edu>
From: pozar@kumr.lns.com (Tim Pozar)
From: jerry@strobe.ATC.Olivetti.Com (Jerry Aguirre)
From: stssram@st.unocal.com (Robert Myers)
From: Reg Quinton <reggers@julian.uwo.ca>
From: Mike Stok <mike@meiko.com>
From: pcc@tis.llnl.gov (Phil Cox)
From: Mark Benard <mb@cs.tulane.edu>
From: rob@merlin.georgetown.edu (Rob Guttmann)
From: jmalcolm@sura.net (Joseph Malcolm)
--
Mark H. Weber | Internet: markw@GVL.Unisys.COM
Paramax Systems (A Unisys Co.) | UUCP: ...!gvlv2!markw
Great Valley Laboratories | FAX: +1 215 648 2891
Box 517, Paoli, PA 19301 USA | VOICE: +1 215 648 2112
NNTP & relative paths (was Re: Need help on installing c-news)
Author: Kenneth Herron
Date: Sat, 21 Mar 1992 04:12
Date: Sat, 21 Mar 1992 04:12
23 lines
1538 bytes
1538 bytes
[How to modify nntp to handle queue files with relative paths] >The modifications fall into 3 different areas: ... >2) Patch nntpxmit - the nntpxmit program can be modified to add > the spool directory to the article filename before it is read. ... If you're going to patch nntpxmit, probably the simplest thing would be to add a chdir() to /usr/spool/news in some appropriate spot, rather than shove strings around for each file in the queue. One of these days I'm going to have to post my perl script for managing nntpxmit... -- Kenneth Herron kherron@ms.uky.edu University of Kentucky +1 606 257 2975 Department of Mathematics "You don't carve 'ARGH,' you just say it!" "Perhaps he was dictating?"
Re: NNTP & relative paths (was Re: Need help on installing c-news)
Author: Randal L. Schwartz
Date: Sun, 22 Mar 1992 02:49
Date: Sun, 22 Mar 1992 02:49
131 lines
5242 bytes
5242 bytes
In article <1992Mar20.231229.22669@ms.uky.edu>, kherron@ms (Kenneth Herron) writes:
| If you're going to patch nntpxmit, probably the simplest thing would
| be to add a chdir() to /usr/spool/news in some appropriate spot, rather
| than shove strings around for each file in the queue.
|
| One of these days I'm going to have to post my perl script for managing
| nntpxmit...
And when you wait to do that, I'll keep posting my shell script (see,
Henry, I don't rewrite EVERYTHING in Perl... :-):
################################################## snip here
#!/bin/sh
#
# nntpsend site1 ... siten
# send nntp batches to remote sites, C news style.
#
# Author: Jean-Francois Lamy, lamy@ai.utoronto.ca, 1989-06-27
# mucked with by Randal L. Schwartz for Cnews /usr/spool/news stuff
#
# We assume that the file of articles to be sent is found under
# $NEWSARTS/out.going/iname/togo, where iname is the site's internet name.
# this may requre a $NEWSLIB/sys entry with an explicit location specified
# if the Usenet name differs, as in the last field of:
#
# utstat:comp,news,ut,tor,can,ont,uw,list/all:F:utstat.toronto.edu/togo
#
# A togo.next file in the site directory may contain articles left over from
# previous transmissions (we append togo to togo.next, call nntpxmit on
# togo.next and it leaves failed articles there).
# =()<. ${NEWSCONFIG-@<NEWSCONFIG>@}>()=
. ${NEWSCONFIG-/usr/lib/news/bin/config}
# we assume $NEWSBIN/nntp is where nntpxmit lives; adjust appropriately
PATH=$NEWSBIN/nntp:$NEWSCTL/bin:$NEWSBIN/batch:$NEWSBIN:$NEWSPATH
export PATH
umask $NEWSUMASK
( # start the subshell for the atomic nntplog update
pname=`basename $0`
echo ${pname}: "[$$]" begin `date`
for host in ${remotes=$*}
do
hostdir=$NEWSARTS/out.going/$host
cd $hostdir
if test -s togo || test -s togo.next
then
# we have articles to send to $host. Lock the news system, so
# that we can be sure that "togo" does not change while we
# append it to the list of things to send out. If we don't do
# that, and relaynews is in a long batch, we could actually
# catch up with relaynews and then we would need some hairy
# stuff to deal with that.
lock="$NEWSCTL/LOCK" # lock relaynews.
ltemp="$NEWSCTL/L.$$"
echo $$ >$ltemp
trap "rm -f $ltemp ; exit 0" 0 1 2 15
while true
do
if newslock $ltemp $lock
then
trap "rm -f $ltemp $lock ; exit 0" 0 1 2 15
break
fi
sleep 30
done
# while relaynews is locked, append the articles to go to
# the togo.next file for the current site. lock current site
# until nntpxmit completes, so we can unlock relaynews asap.
nntplock="$NEWSCTL/LOCKnntpsend.$host"
if newslock $ltemp $nntplock
then
# we have togo.next all to ourselves
trap "rm -f $nntplock $ltemp $lock ; exit 0" 0 1 2 15
if test -s togo.next
then
cat togo >> togo.next 2>/dev/null
rm -f togo
else
mv -f togo togo.next
fi
# unlock news; the host's togo.next file is locked and
# won't be tampered with, so togo no longer matters.
rm -f $ltemp $lock
# perform the actual transfers.
if test -s togo.next
then
echo ${pname}: "[$$]" begin ${host}
(cd $NEWSARTS; nntpxmit ${host}:$hostdir/togo.next)
echo ${pname}: "[$$]" end ${host}
fi
# unlock this site.
rm -f $nntpltemp $nntplock
else
# transfer in progress, leave articles to accumulate
# in ${host} for the time being.
echo ${pname}: "[$$]" ${host} locked by "[`cat $nntplock`]"
rm -f $ltemp $lock
fi # newslock LOCK$host.nntp
fi # test -s togo ...
done
echo ${pname}: "[$$]" end `date`
# end of subshell:
) 2>&1 |
# transfer stdout/stderr a line at a time to the log
while read txt
do echo "$txt" >>$NEWSCTL/log.nntp
done
################################################## snip here
Just another Cnews admin,
--
/=Randal L. Schwartz, Stonehenge Consulting Services (503)777-0095 ==========\
| on contract to Intel's iWarp project, Beaverton, Oregon, USA, Sol III |
| merlyn@iwarp.intel.com ...!any-MX-mailer-like-uunet!iwarp.intel.com!merlyn |
\=Cute Quote: "Intel: putting the 'backward' in 'backward compatible'..."====/
Re: Need help on installing c-news
Author: Henry Spencer
Date: Tue, 24 Mar 1992 17:08
Date: Tue, 24 Mar 1992 17:08
18 lines
1608 bytes
1608 bytes
In article <1992Mar23.033610.19230@celit.fps.com> billd@fps.com (Bill Davidson) writes:
>>There is also a modified nntpsend script for use with Cnews. This script
>>uses the Cnews locking mechanism...
>
>I see no need to lock the news system...
Unfortunately, you really must. There is no other way to be sure that
relaynews is not modifying the batch file as you are trying to grab it
for other uses. Just checking the lock is not good enough; relaynews
could start after the check but before you're finished.
It suffices to lock the news system long enough to grab the file and
rename it (or otherwise copy and empty it), however. You don't need to
hold onto the lock while transmission is being done.
--
GCC 2.0 is to C as SVR4 is to Unix. | Henry Spencer @ U of Toronto Zoology
-Dick Dunn | henry@zoo.toronto.edu utzoo!henry
Re: Need help on installing c-news
Author: W. D. Rolph
Date: Tue, 31 Mar 1992 13:17
Date: Tue, 31 Mar 1992 13:17
11 lines
1055 bytes
1055 bytes
But, again pardon my ignorance, how do I unlock c-news. Probably a dumb question, but I culd not find references to it. Thanks! -- Regards. Don Rolph a722756@pan.mc.ti.com WD3 MS10-13 (508)-699-1263
Re: Need help on installing c-news
Author: Henry Spencer
Date: Tue, 31 Mar 1992 17:06
Date: Tue, 31 Mar 1992 17:06
17 lines
1611 bytes
1611 bytes
In article <1992Mar31.081715@pan.mc.ti.com> a722756@pan.mc.ti.com (W. D. Rolph) writes:
>But, again pardon my ignorance, how do I unlock c-news...
Uh, how did you get it locked? The first thing you should investigate is
why it is locked, and why whatever locked it didn't unlock it properly.
This is not normal behavior.
As a first guess, your system crashed, and your startup stuff (/etc/rc
and friends, on most systems) is not running "newsboot" as it should.
To unlock it, just remove any files in /usr/lib/news whose names start
with "LOCK"... *after* you find out why they are there and make sure the
processes that created them aren't still active.
--
GCC 2.0 is to C as SVR4 is to Unix. | Henry Spencer @ U of Toronto Zoology
-Dick Dunn | henry@zoo.toronto.edu utzoo!henry
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads