From: watanabe@izanami.material.tohoku.ac.jp (Masatoshi Watanabe)
Newsgroups: fj.news.b
Subject: Re: INN on akiu.gw.tohoku.ac.jp
Date: 18 Nov 1992 03:33:12 GMT
Organization: Tohoku Univ., Sendai Japan
Distribution: fj
	<MIT.92Nov17115219@iees2.huie.hokudai.ac.jp>
	<1ec22qINN7d6@fxisms.fxis.fujixerox.co.jp>
NNTP-Posting-Host: izanami.material.tohoku.ac.jp
In-reply-to: taka@fxis.fujixerox.co.jp's message of 18 Nov 1992 00:17:30 GMT

>>>>> On 18 Nov 1992 00:17:30 GMT, taka@fxis.fujixerox.co.jp (Takahiro Kanbe) said:

> $@!&>iD9(Jihave/sendme$@$O$I$&(J$@$d$l$P$G$-$^$9$+!)(J
taka> 1. $@%a%C%;!<%8(JID$@$r%U%!%$%k$KJ]B8$9$k%(%s%H%j$r(Jnewsfeeds(B/Cnew$@$G$$$&$H(J
taka>    $@$3$m$N(Jsys)$@$K:n@.!#(J

taka> 2. 1$@F|(J1$@2s!"(J1.$@$GJ]B8$7$?%U%!%$%k$r(Jrotate$@$7!"?tF|A0$N%U%!%$%k$r(Jinews$@$G(J
taka>    ihave$@$H$7$F%]%9%H$9$k!#(J

taka> $@$H$$$C$?%7%s%W%k(J(?)$@$JJ}K!$G9T$C$F$$$^$9!#$?$@$7!"%9%/%j%W%H$r4hD%(J$@$C$F(J
taka> $@=q$/$D$b$j$,$"$l$P2?$G$b$G$-$k$G$7$g$&!#<B:]!"(JCnews$@$H$[$H$s$IJQ$o$i$J(J
taka> $@$$(Jbatch$@$r9T$&$?(J$@$a$N(J sendbatches $@$H$$$&%Q%C%1!<%8$b$"$j$^$9!#(J($@;DG0$J$,(J
taka> $@$i!"$3$l$b$3$A$i$G$O;H$C$?$3$H$O$"$j$^$;(J$@$s!#(J)

$@<B$O!"$3$A$i$G$O(J Bnews $@$N$3$m$+$i$G$9$,!"(Jsys/newsfeeds $@$K(J ihave $@MQ$N%((J
$@%s%H%j$r:n$i$:$K(J ihave control message $@$r:n$C$F$$$^$9!#(J

$@$I$&$d$C$F$$$k$+$H8@$&$H!"?tF|A0$N(J news $@$N(J syslog $@$N!"5-;v$rAw$C$?$H(J$@8@(J
$@$&5-O?$r(J sed $@$G(J scan $@$7$F(J inews $@$K?)$o$;$k$H8@$&J}K!$G(J ihave $@$r=P$7$F(J
$@$$$^$9!#(J

    nntplink -i logfile

$@$G$d$C$F$$$k;v$r?tF|CY$l$G$d$k$h$&$J46$8$G$9!#(J

    if [ -f ${MOST_LOGS}/OLD/news.2.Z ] ; then
	/usr/ucb/zcat ${MOST_LOGS}/OLD/news.2.Z |\
	${SED} -e 's/$/ /' -e '/+ .* <.*>.* '${SITE}' /!d' \
	       -e 's/^[^<]*//' -e 's/[^>]*$//' >${BATCHFILE}
    fi

$@$H8@$&$h$&$K$7$F!"(J${MOST_LOGS}/OLD/news.2.Z $@$+$i%a%C%;!<%8(J ID $@$N%j%9%H(J
$@$r:n$j$^$9!#(J

INN $@$K$O!"(Jcontrol message $@$,5pBg$K$J$j$9$.$J$$$h$&$K@Z$j9o(J$@$s$GAw$k$h$&(J
$@$J6E$C$?(J send-ihave $@$,IU$$$F$-$F$$$?$N$G!"$;$C$+$/$G$9$+$i!"$3$$$D$r2~(J
$@B$$7$F;H$C$F$$$^$9(J$@!#0J2<$K$D$1$F$*$-$^$9!#(J

#! /bin/sh
##  $Revision: 1.5 $  Changed by watanabe@tohoku.ac.jp
##  SH script to send IHAVE batches out.

##  =()<NEWSBIN=@<_PATH_NEWSBIN>@>()=
NEWSBIN=/usr/local/news/bin
PATH=${NEWSBIN}:${PATH}:/bin:/usr/bin:/usr/ucb ; export PATH
##  =()<SED=@<_PATH_SED>@>()=
SED=/usr/local/bin/sed

##  =()<MOST_LOGS=@<_PATH_MOST_LOGS>@>()=
MOST_LOGS=/var/log/news
##  =()<BATCH=@<_PATH_BATCHDIR>@>()=
BATCH=/var/spool/news/out.going
##  =()<INEWS=@<_PATH_INEWS>@>()=
INEWS=/usr/local/news/inews
##  =()<NEWSLIB=@<_PATH_NEWSLIB>@>()=
NEWSLIB=/usr/local/news
##  =()<LOCKS=@<_PATH_LOCKS>@>()=
LOCKS=/usr/local/news
##  =()<TMPDIR=${TMPDIR-@<_PATH_TMP>@}>()=
TMPDIR=${TMPDIR-/tmp}

PROGNAME=`basename $0`
LOCK=${LOCKS}/LOCK.${PROGNAME}
LOG=${MOST_LOGS}/${PROGNAME}.log

## How many Message-ID's per message.
PERMESSAGE=1000

##  Start logging.
test ! -f ${LOG} && touch ${LOG}
chmod 0660 ${LOG}
exec >>${LOG} 2>&1
echo "${PROGNAME}: [$$] begin `date`"
cd ${BATCH}

##  Anyone else there?
trap 'rm -f ${LOCK} ; exit 1' 1 2 3 15
shlock -p $$ -f ${LOCK} || {
    echo "${PROGNAME}: [$$] locked by [`cat ${LOCK}`]"
    exit 0
}

##  Who are we sending to?
if [ -n "$1" ] ; then
    LIST="$*"
else
    LIST="hogege dehhhehhe ugege hoehoe"
fi

##  Do the work...
for SITE in ${LIST}; do

    ##  See if any data is ready for host.
    BATCHFILE=${SITE}.ihave
    if [ -f ${MOST_LOGS}/OLD/news.2.Z ] ; then
	/usr/ucb/zcat ${MOST_LOGS}/OLD/news.2.Z |\
	${SED} -e 's/$/ /' -e '/+ .* <.*>.* '${SITE}' /!d' \
	       -e 's/^[^<]*//' -e 's/[^>]*$//' >${BATCHFILE}
    fi
    echo "${PROGNAME}: [$$] begin ${SITE}"

    ##  Write out the batchfile as a control message, in clumps.
    export SITE PERMESSAGE BATCHFILE
    while [ -s ${BATCHFILE} ] ; do
	(
	    echo Newsgroups: to.${SITE}
	    echo Control: ihave `hostname`
	    echo ''
	    ${SED} -e ${PERMESSAGE}q <${BATCHFILE}
	) | ${INEWS} -h
	${SED} -e "1,${PERMESSAGE}d" <${BATCHFILE} >${BATCHFILE}.tmp
	mv ${BATCHFILE}.tmp ${BATCHFILE}
    done
    rm ${BATCHFILE}
    echo "${PROGNAME}: [$$] end ${SITE}"
done

##  Remove the lock file.
rm -f ${LOCK}

exit

                         $@$*$7$^$$(J

$@$"!"$=$&$=$&K:$l$+$1$F$^$7$?$,!"%*%j%8%J%k$N(J send-ihave $@$O%P%0$C$F$$(J$@$^(J
$@$9$N$G!"$=$N$^$^;H$$$?$$?M$O0J2<$N$h$&$K%Q%C%A$r$"$F$^$7$g$&!#(J

*** send-ihave.orig	Tue Nov  3 22:29:06 1992
--- send-ihave	Sun Nov  8 17:11:45 1992
***************
*** 74,82 ****
  
      ##  Write out the batchfile as a control message, in clumps.
      export SITE PERMESSAGE BATCHFILE
!     while -s ${BATCHFILE} ; do
  	(
! 	    echo Newsgroup: to.${SITE}
  	    echo Control: ihave `hostname`
  	    echo ''
  	    ${SED} -e ${PERMESSAGE}q <${BATCHFILE}
--- 74,82 ----
  
      ##  Write out the batchfile as a control message, in clumps.
      export SITE PERMESSAGE BATCHFILE
!     while [ -s ${BATCHFILE} ] ; do
  	(
! 	    echo Newsgroups: to.${SITE}
  	    echo Control: ihave `hostname`
  	    echo ''
  	    ${SED} -e ${PERMESSAGE}q <${BATCHFILE}

--
	Masatoshi Watanabe   <watanabe@izanami.material.tohoku.ac.jp>
	Dept.of Metallurgy, Faculty of Engineering, Tohoku Univ.
Xref: sparky fj.news.b:355 fj.sources.d:442