Article View: news.software.nntp
Article #1459Re: NNTP & relative paths (was Re: Need help on installing c-news)
From: 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'..."====/
Technical Details
Message-ID:
<1992Mar22.024934.21104@iWarp.intel.com>Path:
mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!archive.pugleaf.net!archive.newsdeef.eu!mbox2nntp-news.admin.mbox.zip!sparky!uunet!iWarp.intel.com|newsReferences:
<nilsht.61@sofus.dhhalden.no> <1992Mar20.222705.27213@gvl.unisys.com> <1992Mar20.231229.22669@ms.uky.edu>Show Full Headers
Complete Article Headers
Message-ID: <1992Mar22.024934.21104@iWarp.intel.com> Subject: Re: NNTP & relative paths (was Re: Need help on installing c-news) Date: Sun, 22 Mar 1992 02:49:34 GMT From: merlyn@iWarp.intel.com (Randal L. Schwartz) References: <nilsht.61@sofus.dhhalden.no> <1992Mar20.222705.27213@gvl.unisys.com> <1992Mar20.231229.22669@ms.uky.edu> Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!archive.pugleaf.net!archive.newsdeef.eu!mbox2nntp-news.admin.mbox.zip!sparky!uunet!iWarp.intel.com|news Newsgroups: news.software.nntp,news.software.b,news.admin In-Reply-To: kherron@ms.uky.edu (Kenneth Herron) Followup-To: news.software.nntp Sender: news@iWarp.intel.com Nntp-Posting-Host: e06.iwarp.intel.com Reply-To: merlyn@iWarp.intel.com (Randal L. Schwartz) Organization: Stonehenge; netaccess via Intel, Beaverton, Oregon, USA Distribution: na