Source code pulled from OpenBSD for OpenNTPD. The place to contribute to this code is via the OpenBSD CVS tree.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

49 lines
1.1 KiB

  1. #!/bin/sh -
  2. #
  3. # $OpenBSD: weekly,v 1.19 2007/02/02 14:52:48 ajacoutot Exp $
  4. #
  5. umask 022
  6. PATH=/bin:/sbin:/usr/sbin:/usr/bin:/usr/libexec
  7. export PATH
  8. if [ -f /etc/weekly.local ]; then
  9. echo ""
  10. echo "Running weekly.local:"
  11. . /etc/weekly.local
  12. fi
  13. echo ""
  14. if [ -f /var/db/locate.database ]; then
  15. TMP=`mktemp /var/db/locate.database.XXXXXXXXXX`
  16. if [ $? -eq 0 ]; then
  17. trap 'rm -f $TMP; exit 1' 0 1 15
  18. echo "Rebuilding locate database:"
  19. UPDATEDB="/usr/libexec/locate.updatedb"
  20. echo "${UPDATEDB} --fcodes=- --tmpdir=${TMPDIR:-/var/tmp}" | \
  21. nice -5 su -m nobody 2>/dev/null 1>$TMP
  22. if [ -s "$TMP" ]; then
  23. chmod 444 $TMP
  24. chown root:wheel $TMP
  25. mv -f $TMP /var/db/locate.database
  26. else
  27. echo "Not installing locate database; zero size"
  28. fi
  29. else
  30. echo "Not rebuilding locate database; can't create temp file"
  31. fi
  32. else
  33. echo "Not rebuilding locate database; no /var/db/locate.database"
  34. fi
  35. echo ""
  36. echo "Rebuilding whatis databases:"
  37. makewhatis
  38. # If LOGINACCOUNTING is set to 1 in the environment, report user
  39. # accounting information
  40. [ "X$LOGINACCOUNTING" = X1 ] && {
  41. echo ""
  42. echo "Doing login accounting:"
  43. ac -p | sort -nr -k 2
  44. }