Article View: news.software.nntp
Article #7722Modified nntpsend for Cnews
From: Edward Siewick
Date: Sat, 18 May 1996 00:00
Date: Sat, 18 May 1996 00:00
158 lines
5367 bytes
5367 bytes
Hi,
The following shar'd version of nntpsend was modified to deal with
multiple downstream sites by separating out the list of sites
into, well, lists. I used this on a "hub" site feeding a non-Usenet
"local" heirarchy of newsgroups to a group of twenty small (SCO Xenix
and SCO UNIX) servers running Cnews. If you're running Cnews and
have several sites to feed, you might have an interest in this script.
My main goal in making the modification was to avoid SCO's line length
limitations, and to keep folks from having to muck around with the root
crontab.
Edward Siewick
--
ESiewick@DigiPro.com DigiPro Digital Productions, LLC
Voice: 703-522-8465 3100 North Quincy Street
Fax: 703-522-8417 Arlington, Virginia 22207
+- -*- -+
#!/bin/sh
# This is a shell archive (produced by GNU sharutils 4.1).
# To extract the files from this archive, save it to some FILE, remove
# everything before the `!/bin/sh' line above, then type `sh FILE'.
#
# Made on 1996-05-18 10:51 EDT by <root@rodman>.
# Source directory was `/usr/local/archive/inn/Tools/nntpsend'.
#
# Existing files will *not* be overwritten unless `-c' is specified.
#
# This shar contains:
# length mode name
# ------ ---------- ------------------------------------------
# 2470 -rw-rw-r-- nntpsend
#
touch -am 1231235999 $$.touch >/dev/null 2>&1
if test ! -f 1231235999 && test -f $$.touch; then
shar_touch=touch
else
shar_touch=:
echo
echo 'WARNING: not restoring timestamps. Consider getting and'
echo "installing GNU \`touch', distributed in GNU File Utilities..."
echo
fi
rm -f 1231235999 $$.touch
#
# ============= nntpsend ==============
if test -f 'nntpsend' && test X"$1" != X"-c"; then
echo 'x - skipping nntpsend (file already exists)'
else
echo 'x - extracting nntpsend (text)'
sed 's/^X//' << 'SHAR_EOF' > 'nntpsend' &&
#!/bin/ksh
X
# $Header: nntpsend,v 2.2 95/07/18 21:27:04 sob Exp $
# What we have here is a sh script for sending netnews to NNTP sites.
X
# Modified, 95/07/27 by Edward Siewick, DigiPro, for use with
# extended list of sites to feed. To use put a line in the
# crontab something like:
#
# 31 * * * * /etc/nntpsend >/dev/null 2>&1
#
# or
#
# 11 1 * * * /etc/nntpsend -l /usr/lib/news/nntp.sites.ynh1 >/dev/null 2>&1
# 31 2 * * * /etc/nntpsend -l /usr/lib/news/nntp.sites.ynh2 >/dev/null 2>&1
# 51 3 * * * /etc/nntpsend -l /usr/lib/news/nntp.sites.ynh3 >/dev/null 2>&1
#
# The script expects to find lists of sites to be fed in files named
# something like /usr/lib/news/nntp.sites[.ynh] (Your Name Here).
#
# The nntp.sites[.ynh] files are referenced by this modified
# nntpsend.sh (/etc/nntpsend). Format is simply one site per line. Each
# entry should match the system name as specified in the first field of the
# /usr/lib/news/sys file.
#
# If an nntp.sites.* filename is not specified on the command line, nntpsend
# looks for a /usr/lib/news/nntp.sites file.
#
# Caveat: will cause trouble if separate calls chronologically "step
# on each other's tails." I never let this happen.
#
# Use this script at your own descretion and risk. No Warranties. Period.
X
batchdir=/usr/spool/news/batch
libdir=/usr/lib/news
X
PATH=${libdir}:/usr/ucb:/usr/bin:/bin:${PATH}
export PATH
X
if [ `getopts ":l:" opt` ]; then
X case $opt in
X l ) Sites=$OPTARG ;;
X \? ) echo "Usage: $0 [-l /some/nntp.file.list ]"
X exit 1 ;;
X esac
elif [ -f ${libdir}/nntp.sites ]; then
X Sites=${libdir}/nntp.sites
else
X echo "$0: Please specify an nntp.sites file"
X exit 2
fi
X
uname=022
pname=`basename $0`
echo ${pname}: "[$$]" begin `date`
cd ${batchdir}
X
for host in `cat ${Sites}`
X do
X lock=L.${host}
X tmp=${host}.tmp
X send=${host}.nntp
X if shlock -p $$ -f ${lock} ; then
X if [ -f ${tmp} ]; then
X cat ${tmp} >> ${send}
X rm ${tmp}
X fi
X
X if [ -f ${host} ]; then
X if [ -f ${send} ]; then
X mv ${host} ${tmp}
X else
X mv ${host} ${send}
X fi
X fi
X
X if [ -f ${send} ]; then
X echo ${pname}: "[$$]" begin ${host}
X time /usr/lib/news/nntpxmit ${host}:${send}
X echo ${pname}: "[$$]" end ${host}
X fi
X rm -f ${lock}
X else
X echo ${pname}: "[$$]" ${host} locked by "[`cat ${lock}`]"
X fi
X done
X
echo ${pname}: "[$$]" end `date`
X
### EOF
X
SHAR_EOF
$shar_touch -am 0517212096 'nntpsend' &&
chmod 0664 'nntpsend' ||
echo 'restore of nntpsend failed'
shar_count="`wc -c < 'nntpsend'`"
test 2470 -eq "$shar_count" ||
echo "nntpsend: original size 2470, current size $shar_count"
fi
exit 0
Technical Details
Message-ID:
<4nkpq3$b3c@rodman.digipro.com>Path:
mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!archive.pugleaf.net!archive.newsdeef.eu!mbox2nntp-news.software.nntp.mbox.zip!not-for-mailShow Full Headers
Complete Article Headers
Message-ID: <4nkpq3$b3c@rodman.digipro.com> Subject: Modified nntpsend for Cnews Date: Sat, 18 May 1996 00:00:00 +0000 From: esiewick@digipro.com (Edward Siewick) Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!archive.pugleaf.net!archive.newsdeef.eu!mbox2nntp-news.software.nntp.mbox.zip!not-for-mail X-Deja-AN: 155552167 Organization: DigiPro Digital Productions, LLC Newsgroups: news.software.nntp