home *** CD-ROM | disk | FTP | other *** search
/ Unix System Administration Handbook 1997 October / usah_oct97.iso / news / cnews.tar / batch / batchra < prev    next >
Text File  |  1994-08-17  |  733b  |  26 lines

  1. #! /bin/sh
  2. # batchra [file...] - requested-articles batcher - read sendme message(s),
  3. # look up history entries and get file names, append the names to batch file
  4.  
  5. # =()<. ${NEWSCONFIG-@<NEWSCONFIG>@}>()=
  6. . ${NEWSCONFIG-/etc/news/bin/config}
  7. PATH=$NEWSCTL/bin:$NEWSBIN/batch:$NEWSBIN:$NEWSPATH; export PATH
  8.  
  9. batchdir=`expr "$NEWSSITEDIR" : "^\(.*\)\.[^./]*$"`
  10. case "$batchdir" in
  11. '')    batchdir="$NEWSARTS/out.going/$NEWSSITE"    ;;
  12. esac
  13. files="`cat $*`"
  14.  
  15. lock LOCKexplode $$ || exit 1
  16. trap "unlock LOCKexplode ; trap 0 ; exit 0" 0 1 2 15
  17.  
  18. for f in $files
  19. do
  20.     if test -r $f    # ignore control files that have vanished
  21.     then
  22.         sed '1,/^$/d' $f
  23.     fi
  24. done | egrep '^<' | dbz -x $NEWSCTL/history |
  25.     awk '{ print $NF }' | tr . / >>$batchdir/togo
  26.