home *** CD-ROM | disk | FTP | other *** search
/ Il CD di internet / CD.iso / SOURCE / N / NN / _NN-SPOO.TAR / usr / lib / nn / back_act < prev    next >
Encoding:
Text File  |  1994-09-13  |  884 b   |  53 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=false
  10. ACTIVE=/var/lib/news/active
  11. LOG=/usr/lib/nn/Log
  12. TMP=${TMPDIR-/usr/tmp}
  13. DB=/var/spool/nn
  14. BIN=/usr/bin
  15. LIB=/usr/lib/nn
  16. AUTH=false
  17.  
  18. # ---- end of prefix
  19.  
  20. # prefix is inserted above by make
  21.  
  22. #
  23. #    back_act will maintain a set of `old' active files
  24. #    in the DB directory where they can be used by nngoback
  25. #    to backtrack the rc file a number of days.
  26. #
  27. #    It should be invoked by cron every day at midnight.
  28. #    It should run as user `news'!
  29. #
  30. #    Call:  back_act [days]
  31. #    Default: keep copy of active file for the last 14 days.
  32.  
  33. cd $DB || exit 1
  34.  
  35. p=${1-15}
  36. l=""
  37. while [ "$p" -gt 0 ]
  38. do
  39.     i="`expr $p - 1`"
  40.     if [ -f active.$i ]
  41.     then
  42.         mv active.$i active.$p
  43.         l=$p
  44.     elif [ -n "$l" ]
  45.     then
  46.         ln active.$l active.$p
  47.     fi
  48.     p=$i
  49. done
  50.  
  51. cp $ACTIVE active.0
  52. chmod 644 active.0
  53.