/usr/lib/news/bin/send-ihave is in inn2 2.6.1-4build1.
This file is owned by root:root, with mode 0o755.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 | #! /bin/sh
. /usr/lib/news/innshellvars
## $Revision: 2674 $
## SH script to send IHAVE batches out.
PROGNAME=`basename $0`
LOG=${MOST_LOGS}/${PROGNAME}.log
## How many Message-ID's per message.
PERMESSAGE=1000
## Go to where the action is, start logging
cd $BATCH
umask 002
DEBUG=""
if [ "X$1" = X-d ] ; then
DEBUG="-d"
shift
else
test ! -f ${LOG} && touch ${LOG}
chmod 0660 ${LOG}
exec >>${LOG} 2>&1
fi
echo "${PROGNAME}: [$$] begin `date`"
## List of sitename:hostname pairs to send to
if [ -n "$1" ] ; then
LIST="$*"
else
echo "${PROGNAME}: [$$] no sites specified" >&2
exit 1
fi
## Do the work...
for SITE in ${LIST}; do
case $SITE in
*:*)
HOST=`expr $SITE : '.*:\(.*\)'`
SITE=`expr $SITE : '\(.*\):.*'`
;;
*)
HOST=$SITE
;;
esac
BATCHFILE=${SITE}.ihave.batch
LOCK=${LOCKS}/LOCK.${SITE}.ihave
trap 'rm -f ${LOCK} ; exit 1' 1 2 3 15
shlock -p $$ -f ${LOCK} || {
echo "${PROGNAME}: [$$] ${SITE}.ihave locked by `cat ${LOCK}`"
continue
}
## See if any data is ready for host.
if [ -f ${SITE}.ihave.work ] ; then
cat ${SITE}.ihave.work >>${BATCHFILE}
rm -f ${SITE}.ihave.work
fi
if [ ! -f ${SITE}.ihave -o ! -s ${SITE}.ihave ] ; then
if [ ! -f ${BATCHFILE} -o ! -s ${BATCHFILE} ] ; then
rm -f ${LOCK}
continue
fi
fi
mv ${SITE}.ihave ${SITE}.ihave.work
ctlinnd -s -t30 flush ${SITE}.ihave || continue
cat ${SITE}.ihave.work >>${BATCHFILE}
rm -f ${SITE}.ihave.work
if [ ! -s ${BATCHFILE} ] ; then
echo "${PROGNAME}: [$$] no articles for ${SITE}.ihave"
rm -f ${BATCHFILE}
continue
fi
echo "${PROGNAME}: [$$] begin ${SITE}.ihave"
## Write out the batchfile as a control message, in clumps.
export SITE PERMESSAGE BATCHFILE
while test -s ${BATCHFILE} ; do
(
echo Newsgroups: to.${SITE}
echo Control: ihave `innconfval pathhost`
echo Subject: cmsg ihave `innconfval pathhost`
echo ''
${SED} -e ${PERMESSAGE}q <${BATCHFILE}
) | ${INEWS} -h
${SED} -e "1,${PERMESSAGE}d" <${BATCHFILE} >${BATCHFILE}.tmp
mv ${BATCHFILE}.tmp ${BATCHFILE}
done
echo "${PROGNAME}: [$$] end ${SITE}.ihave"
rm -f ${LOCK}
done
echo "${PROGNAME}: [$$] end `date`"
|