home *** CD-ROM | disk | FTP | other *** search
/ Il CD di internet / CD.iso / SOURCE / N / CNEWS / _CNEWS.TAR / usr / lib / newsbin / maint / newswatch < prev   
Encoding:
Text File  |  1994-09-02  |  1.2 KB  |  63 lines

  1. #! /bin/sh
  2. # newswatch [spacemin [batchmax]]
  3. # look for anomalies, notably locks present a long time
  4.  
  5. # =()<. ${NEWSCONFIG-@<NEWSCONFIG>@}>()=
  6. . ${NEWSCONFIG-/var/lib/news/bin/config}
  7.  
  8. PATH=$NEWSCTL/bin:$NEWSBIN/maint:$NEWSBIN:$NEWSPATH ; export PATH
  9. umask $NEWSUMASK
  10.  
  11. tmp=/tmp/newsw$$
  12. >$tmp
  13.  
  14. cd $NEWSCTL
  15.  
  16. locks="`echo LOCK* $NEWSARTS/out.going/*/L*`"
  17. if test -r watchtime -a " $locks" != " LOCK* $NEWSARTS/out.going/*/L*"
  18. then
  19.     trouble="`find $locks ! -newer watchtime -print 2>/dev/null`"
  20.     if test " $trouble" != " "
  21.     then
  22.         echo 'Suspiciously old locks:' >>$tmp
  23.         ls -ldtr $trouble >>$tmp
  24.         echo
  25.     fi
  26. fi
  27.  
  28. if test " $1" != " "
  29. then
  30.     didsome=n
  31.     for fs in incoming articles control outbound
  32.     do
  33.         if test " `spacefor $1 $fs`" -eq 0
  34.         then
  35.             echo "\`spacefor $1 $fs' reports disk shortage" >>$tmp
  36.             didsome=y
  37.         fi
  38.     done
  39.     if test " $didsome" = " y"
  40.     then
  41.         echo
  42.     fi
  43. fi
  44.  
  45. if test " $2" != " "
  46. then
  47.     n="`ls $NEWSARTS/in.coming | egrep '^[0-9]' | wc -l`"
  48.     if test " $n" -gt " $2"
  49.     then
  50.         echo "There are a great many spooled input batches ($n)."
  51.         echo
  52.     fi
  53. fi
  54.  
  55. if test -s $tmp
  56. then
  57.     echo 'Subject: newswatch has detected news-system anomalies'
  58.     echo
  59.     cat $tmp
  60. fi
  61. rm -f $tmp
  62. touch watchtime
  63.