home *** CD-ROM | disk | FTP | other *** search
/ PC-Online 1996 May / PCOnline_05_1996.bin / linux / source / n / tcpip / nntp-1.5 / nntp-1 / nntp.1.5.11t / xmit / nntpsend.sh < prev    next >
Encoding:
Linux/UNIX/POSIX Shell Script  |  1993-10-17  |  1.4 KB  |  57 lines

  1. #!/bin/sh
  2. # $Header: nntpsend.sh,v 1.2 90/08/11 21:27:04 sob Exp $
  3. # What we have here is a sh script for sending netnews to NNTP sites.
  4. #
  5. batchdir=/usr/spool/news/batch
  6. libdir=/usr/spool/news/lib
  7. PATH=${libdir}:/usr/ucb:/usr/bin:/bin:${PATH}
  8. export PATH
  9. pname=`basename $0`
  10. echo ${pname}: "[$$]" begin `date`
  11. #
  12. # Go to where the action is
  13. #
  14. cd $batchdir
  15. umask 022
  16. #
  17. #    For NNTP
  18. #
  19. #    Here "foo", "bar", and "zot" are the Internet names of
  20. #    the machines to which to send.  We make the supposition
  21. #    that the batch files will be a host's internet name.
  22. #    So, for example "nike"'s internet name is "ames-titan.arpa".
  23. #    Because of this, your sys file must have "ames-titan.arpa"
  24. #    as the batch file output for the machine "nike".
  25. #
  26. for host in ${remotes=$*}
  27. do
  28.     lock=L.${host}
  29.     tmp=${host}.tmp
  30.     send=${host}.nntp
  31.     if shlock -p $$ -f ${lock} ; then
  32.         if test -f ${tmp} ; then
  33.             cat ${tmp} >> ${send}
  34.             rm ${tmp}
  35.         fi
  36. # we let the tmp file cool off for a while if there's other work to do
  37. # and we pick it up again during next iteration
  38.         if test -f ${host} ; then
  39.             if test -f ${send} ; then
  40.                 mv ${host} ${tmp}
  41.             else
  42.                 mv ${host} ${send}
  43.             fi
  44.         fi
  45.         if test -f ${send} ; then
  46.             echo ${pname}: "[$$]" begin ${host}
  47.             time nntpxmit ${host}:${send}
  48.             echo ${pname}: "[$$]" end ${host}
  49.         fi
  50.         rm -f ${lock}
  51.     else
  52.         echo ${pname}: "[$$]" ${host} locked by "[`cat ${lock}`]"
  53.     fi
  54. done
  55. echo ${pname}: "[$$]" end `date`
  56.  
  57.