#!/bin/sh # # exec by news # PATH=/usr/local/bin:/usr/local/sbin:/usr/local/news/bin:/usr/local/news/sbin:/usr/bin:/usr/sbin:/bin:/sbin export PATH # # get lock # mkdir /tmp/putnews.sh.LOCK || exit 1 # # base directory for catv # basedir=~news/provider/catv # # password file # PASSWDFILE=${basedir}/etc/passwd.nntp export PASSWDFILE # # ニュースサーバ設定 # #NNTPSERVER=news.cis.dfn.de NNTPSERVER=news.catv.ne.jp # # バッチファイル名 # #BATCHFILE=news.cis.dfn.de BATCHFILE=news.catv.ne.jp # # ポストコマンドパス # POSTCMD=${basedir}/etc/sendnews.pl # # タイムアウト(秒) # TIMEOUT=60 # # スプールディレクトリ # SPOOLDIR=/usr/local/news/spool #---------------------------------------------------------------------- # # ローカルホストからの投稿を取り出し # ctlinnd pause post sort ${SPOOLDIR}/outgoing/${BATCHFILE} | \ uniq >${basedir}/tmp/putnews.tmp1.$$ cp /dev/null ${SPOOLDIR}/outgoing/${BATCHFILE} ctlinnd go post # # リモートホストに投稿 # for i in `cat ${basedir}/tmp/putnews.tmp1.$$ | sed -e 's/ /,/g'` do dir=`echo $i | cut -d ',' -f 1 | sed -e 's/\./\//g'` msgid=`echo $i | cut -d ',' -f 2` file=`egrep -i "^Message-ID: *${msgid}" \ ${SPOOLDIR}/articles/${dir}/* /dev/null |\ cut -d : -f 1 |\ head -1` check=`cat ${file} |\ grep '^Organization: *M.Y.H'` if [ "X${check}" != "X" ] then cat ${file} |\ egrep -v "^NNTP-Posting-[A-z]*: " | \ egrep -v "^Xref: " | \ egrep -v "^Path: " | \ egrep -v "^Date: " | \ egrep -v "^Lines: " | \ egrep -v "^Message-ID: " | \ egrep -v "^X-[A-z].*: " | \ ${POSTCMD} ${NNTPSERVER} ${TIMEOUT} if [ $? -eq 0 ] then echo ${file} " " posting succeed. else echo ${file} " " posting failure. echo ${file} " " posting failure. >>${basedir}/etc/postfail.log fi fi sleep 1 done # rm ${basedir}/tmp/putnews.tmp1.$$ # # release lock # rmdir /tmp/putnews.sh.LOCK