From news.software.b Wed Dec 9 22:49:47 1992 Path: deshaw.com!cmcl2!yale.edu!qt.cs.utexas.edu!cs.utexas.edu!sdd.hp.com!zaphod.mps.ohio-state.edu!uwm.edu!ogicse!flop.ENGR.ORST.EDU!gaia.ucs.orst.edu!cerridwen.UCS.ORST.EDU!kean From: kean@cerridwen.UCS.ORST.EDU (Kean Stump) Newsgroups: news.software.b Subject: tallyho wrapper for INN [was Re: Daily Statistics [script]] Message-ID: <1g5ro8INNdbp@gaia.ucs.orst.edu> Date: 9 Dec 92 22:25:12 GMT Article-I.D.: gaia.1g5ro8INNdbp References: Organization: University Computing Services, OSU Lines: 133 NNTP-Posting-Host: cerridwen.ucs.orst.edu To use tallyho nicely with INN, add this to your newsfeeds file: TALLY:*:Tf,Wnb:/var/log/news/tally/tally then run the enclosed script after your news.daily. I took sendbatches (thanks to Christophe.Wolfhugel@grasp.insa-lyon.fr for the INN version of sendbatches), removed the batching section from it, added in log rotation for my site and a call to tallyho. Run tally.driver after your news.daily executes. I haven't checked control conflicts between this script and innd, hence run it after news.daily. This appears to work for me. Your mileage may vary, if this breaks you're guaranteed to posess at least two pieces of broken code etc etc. --kean ps - tallyho may be retrieved from ftp.cs.toronto.edu:pub/news/{tallyho, tally.doc}. #! /bin/sh # This is a shell archive. Remove anything before this line, then unpack # it by saving it into a file and typing "sh file". To overwrite existing # files, type "sh file -c". You can also feed this as standard input via # unshar, or by typing "sh 'tally.driver' <<'END_OF_FILE' X#! /bin/sh X## $Revision: 1.1 $ X## SH script to drive tally X X# =()@>()= XNEWSBIN=/inn/bin XTALLYHO=tallyho XTALLY=tally XPATH=${NEWSBIN}/batch:${NEWSBIN}:${PATH}:/bin:/usr/bin:/usr/ucb:/inn/local/bin; export PATH X X# =()@>()= XLOG=/var/log/news/tally X# =()@>()= XBATCH=/inn/spool/out.going X# =()@>()= XLIB=/inn/lib X# =()@>()= XLOCKS=/inn/locks X## =()@}>()= XTMPDIR=${TMPDIR-/tmp} XXPID=$$ ; export XPID X XPNAME=`basename $0` XCTLFILE=${LIB}/${PNAME}.ctl X X## Go to the right dir Xcd ${LOG} X X## Anyone else there? XLOCK=${LOCKS}/LOCK.tally Xtrap 'rm -f ${LOCK} ; exit 1' 1 2 3 15 Xshlock -p $$ -f ${LOCK} || { X echo "${PNAME}: [$$] locked by [`cat ${LOCK}`]" X exit 0 X} X X# Hackery. Will fix later, if we really care... XLIST=tally X#if [ ! -z "$1" ] ; then X# LIST="$*" X#else X# echo "${PNAME}: [$$] no site specified" X# exit 1 X#fi X X X## Do the log... Xfor SITE in ${LIST}; do X BATCHFILE=${SITE}.tmp X if [ -f ${SITE}.log ] ; then X cat ${SITE}.log >>${BATCHFILE} X rm ${SITE}.log X fi X mv ${SITE} ${SITE}.log X ctlinnd -s -t30 flush ${SITE} || { X echo "${PNAME}: [$$] Can't flush ${SITE}." X continue X } X cat ${SITE}.log >>${BATCHFILE} X rm -f ${SITE}.log X if [ ! -s ${BATCHFILE} ] ; then X echo "${PNAME}: [$$] no articles for ${SITE}" X continue X fi X Xecho "INN traffic stats for `date`" X $TALLYHO ${BATCHFILE} X X cat $TALLY.7 >>$TALLY.all X mv $TALLY.6 $TALLY.7 X mv $TALLY.5 $TALLY.6 X mv $TALLY.4 $TALLY.5 X mv $TALLY.3 $TALLY.4 X mv $TALLY.2 $TALLY.3 X mv $TALLY.1 $TALLY.2 X mv $TALLY.0 $TALLY.1 X cp ${BATCHFILE} $TALLY.0 X rm -f ${BATCHFILE} X X Xdone X## Remove the lock file. Xrm -f ${LOCK} Xexit 0 END_OF_FILE if test 1789 -ne `wc -c <'tally.driver'`; then echo shar: \"'tally.driver'\" unpacked with wrong size! fi chmod +x 'tally.driver' # end of 'tally.driver' fi echo shar: End of shell archive. exit 0 -- Kean Stump kean@ucs.orst.edu (503)-737-4740 Oregon State Network Operations Cthulu Saves, In Case OSU doesn't pay me enough to have official opinions. It's Hungry Later