home *** CD-ROM | disk | FTP | other *** search
/ Il CD di internet / CD.iso / SOURCE / N / NN / _NN-NNTP.TAR / usr / lib / nn / back_act < prev    next >
Encoding:
Text File  |  1994-09-13  |  894 b   |  54 lines

  1. #!/bin/sh
  2.  
  3. # Generated by nn release 6.4.18
  4.  
  5. VERSION="6.4.18"
  6. INEWS="/usr/bin/inews"
  7. INEWS_DIR="/usr/bin"
  8. AWK="awk"
  9. NNTP=true
  10. ACTIVE=/var/spool/nn/ACTIVE
  11. NNTPCACHE=
  12. LOG=/usr/lib/nn/Log
  13. TMP=${TMPDIR-/usr/tmp}
  14. DB=/var/spool/nn
  15. BIN=/usr/bin
  16. LIB=/usr/lib/nn
  17. AUTH=false
  18.  
  19. # ---- end of prefix
  20.  
  21. # prefix is inserted above by make
  22.  
  23. #
  24. #    back_act will maintain a set of `old' active files
  25. #    in the DB directory where they can be used by nngoback
  26. #    to backtrack the rc file a number of days.
  27. #
  28. #    It should be invoked by cron every day at midnight.
  29. #    It should run as user `news'!
  30. #
  31. #    Call:  back_act [days]
  32. #    Default: keep copy of active file for the last 14 days.
  33.  
  34. cd $DB || exit 1
  35.  
  36. p=${1-15}
  37. l=""
  38. while [ "$p" -gt 0 ]
  39. do
  40.     i="`expr $p - 1`"
  41.     if [ -f active.$i ]
  42.     then
  43.         mv active.$i active.$p
  44.         l=$p
  45.     elif [ -n "$l" ]
  46.     then
  47.         ln active.$l active.$p
  48.     fi
  49.     p=$i
  50. done
  51.  
  52. cp $ACTIVE active.0
  53. chmod 644 active.0
  54.