|
|
1.1 ! root 1: #!/bin/csh -f ! 2: # ! 3: # What we have here is a csh script for sending netnews to NNTP sites. ! 4: # ! 5: set batchdir=/usr/spool/news/batch libdir=/usr/spool/news/lib ! 6: set path=( $libdir /usr/ucb /usr/bin /bin $path ) ! 7: set pname=$0 ! 8: set pname=$pname:t ! 9: echo ${pname}: "[$$]" begin `date` ! 10: # ! 11: # Go to where the action is ! 12: # ! 13: cd $batchdir ! 14: umask 022 ! 15: # ! 16: # For NNTP ! 17: # ! 18: # Here "foo", "bar", and "zot" are the Internet names of ! 19: # the machines to which to send. We make the supposition ! 20: # that the batch files will be a host's internet name. ! 21: # So, for example "nike"'s internet name is "ames-titan.arpa". ! 22: # Because of this, your sys file must have "ames-titan.arpa" ! 23: # as the batch file output for the machine "nike". ! 24: # ! 25: foreach host ( foo bar zot ) ! 26: set lock=NNTP_LOCK.${host} tmp=${host}.tmp send=${host}.nntp ! 27: shlock -p $$ -f ${lock} ! 28: if ($status == 0) then ! 29: if ( -e ${tmp} ) then ! 30: cat ${tmp} >> ${send} ! 31: rm ${tmp} ! 32: endif ! 33: if ( -e ${host} ) then ! 34: # this depends upon the atomicity of the rename(2) system call used in mv(1) ! 35: mv ${host} ${tmp} ! 36: cat ${tmp} >> ${send} ! 37: rm ${tmp} ! 38: endif ! 39: if ( -e ${send} ) then ! 40: echo ${pname}: "[$$]" begin ${host} ! 41: time nntpxmit ${host}:${send} ! 42: echo ${pname}: "[$$]" end ${host} ! 43: endif ! 44: rm -f ${lock} ! 45: else ! 46: echo ${pname}: "[$$]" ${host} locked by "[`cat ${lock}`]" ! 47: endif ! 48: end ! 49: echo ${pname}: "[$$]" end `date`
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.