🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: news.software.nntp
Article #244

Locking problem with C news and nntpsend

#244
From: david
Date: Thu, 20 Jul 1989 02:39
62 lines
2419 bytes
The nntpsend.{csh,sh} programs in the current nntp distribution do not
lock properly with C news relaynews.

Situation:
	Relaynews is running and it has opened up the batch files for
the out going systems.  Nntpsend starts up and finds that the batch
file is non-empty so it mv's it to host.nntp and fires up nntpxmit.
If nntpxmit finishes before relaynews does it will unlink host.nntp
which relaynews still has open and thus the articles not yet batched
will disappear.

This will effect sites that have nntpsend running at the same time as 
relaynews and especially those sites that run nntpsend once a minute.

My solution was to create a small shell program that did a newslock
on LOCK before doing the mv.  It was cloned after the batchsplit
shell script and is quite simple.  I called it "nntpmv" and replaced
the two calls to mv with it and it appears to solve the problem.

Someone mentioned reworking NNTP 1.5.5 to work and lock in the C news
way of doing things but I have not seen it distributed yet.

	-David Robinson
	david@elroy.jpl.nasa.gov
============
#! /bin/sh
# Move off NNTP batches
# nntpmv ifile ofile

# =()<. ${NEWSCONFIG-@<NEWSCONFIG>@}>()=
 ${NEWSCONFIG-/usr/lib/news/bin/config}

PATH=$NEWSCTL/bin:$NEWSBIN/batch:$NEWSBIN:$NEWSPATH ; export PATH
umask $NEWSUMASK

# Locking.
lock="$NEWSCTL/LOCK"
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 10
done

if test -f $2
then
	exit 0
fi

mv $1 $2
==========
	David Robinson		elroy!david@csvax.caltech.edu     ARPA
				david@elroy.jpl.nasa.gov	  ARPA
				{cit-vax,ames}!elroy!david	  UUCP
Disclaimer: No one listens to me anyway!
Technical Details
Message-ID: <1989Jul20.023946.28513@elroy.jpl.nasa.gov>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!archive.pugleaf.net!archive.newsdeef.eu!mbox2nntp!utzoo!utgpu!jarvis.csri.toronto.edu!rutgers!apple!usc!elroy.jpl.nasa.gov!news

Show Full Headers
Complete Article Headers
Message-ID: <1989Jul20.023946.28513@elroy.jpl.nasa.gov>
Subject: Locking problem with C news and nntpsend
Date: Thu, 20 Jul 1989 02:39:46 +0000
From: david@elroy.jpl.nasa.gov
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!archive.pugleaf.net!archive.newsdeef.eu!mbox2nntp!utzoo!utgpu!jarvis.csri.toronto.edu!rutgers!apple!usc!elroy.jpl.nasa.gov!news
Newsgroups: news.software.b,news.software.nntp
Reply-To: david@elroy.jpl.nasa.gov ()
Organization: Image Analysis Systems Grp, JPL
Lines: 61