home *** CD-ROM | disk | FTP | other *** search
/ Nebula 1 / Nebula One.iso / Internet / FTP / Mirror2.3 / mirror.nightly < prev    next >
Encoding:
Text File  |  1994-01-18  |  1.2 KB  |  60 lines

  1. #!/bin/sh
  2. # Manage a nightly mirror run.
  3. # Most of the dirty work is done via mm.  This
  4. # really just handles the logs and mails them out.
  5.  
  6. # Where mirror and mm are to be found
  7. home=/extra/mirror
  8.  
  9. # Who and how to mail stuff back
  10. mailto=lmjm
  11. mail=mail
  12. mailargs="-s 'nightly mirror log'"
  13.  
  14. # Argument to pass to sort to get it to show the biggest files
  15. # in a directory listing.
  16. #BSD usually +3n, System 5 usually +4n.
  17. biggest=+3n
  18.  
  19. # You shouldn't have to change anything below here.
  20.  
  21. # Log output here.
  22. log=mirror.nightly.out
  23.  
  24. cd $home
  25.  
  26. if [ -r $log ]; then
  27.     # Keep one days backups of the old logs
  28.     mv -f $log $log.old
  29. fi
  30.  
  31. # Run mirror master
  32. #  It will output all the package log info' into files in
  33. # the logs/ directory.
  34. rm -f $log
  35. if test ! -d logs; then mkdir logs; fi
  36. ./mm -debug mmin >$log 2>&1 < /dev/null
  37.  
  38. # Send me the "interesting" bits of the logs
  39. # The old, new and big stuff
  40. ls -ltr logs > /tmp/mn-log
  41. (
  42.     cd logs
  43.     echo Unlinks needed on:
  44.     grep -l "^NEED" *
  45.     echo
  46.     echo Old:
  47.     head /tmp/mn-log
  48.     echo
  49.     echo Recent:
  50.     tail /tmp/mn-log
  51.     echo
  52.     echo Biggest:
  53.     sort $biggest < /tmp/mn-log | tail
  54.     echo
  55.     echo The interesting logs::
  56.     ../prune_logs *
  57. ) > /tmp/mn-msg
  58. eval $mail $mailargs $mailto < /tmp/mn-msg
  59. rm -f /tmp/mn-log /tmp/mn-msg
  60.