home *** CD-ROM | disk | FTP | other *** search
/ Unix System Administration Handbook 1997 October / usah_oct97.iso / news / nn.tar / nn-6.5.1 / back_act.sh < prev    next >
Text File  |  1995-04-29  |  606b  |  34 lines

  1. # prefix is inserted above by make
  2.  
  3. #
  4. #    back_act will maintain a set of `old' active files
  5. #    in the DB directory where they can be used by nngoback
  6. #    to backtrack the rc file a number of days.
  7. #
  8. #    It should be invoked by cron every day at midnight.
  9. #    It should run as user `news'!
  10. #
  11. #    Call:  back_act [days]
  12. #    Default: keep copy of active file for the last 14 days.
  13.  
  14. cd $DB || exit 1
  15.  
  16. p=${1-15}
  17. l=""
  18. while [ "$p" -gt 0 ]
  19. do
  20.     i="`expr $p - 1`"
  21.     if [ -f active.$i ]
  22.     then
  23.         mv active.$i active.$p
  24.         l=$p
  25.     elif [ -n "$l" ]
  26.     then
  27.         ln active.$l active.$p
  28.     fi
  29.     p=$i
  30. done
  31.  
  32. cp $ACTIVE active.0
  33. chmod 644 active.0
  34.