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
938 B

  1. #
  2. # $OpenBSD: monthly,v 1.12 2009/05/25 21:31:24 schwarze Exp $
  3. #
  4. # For local additions, create the file /etc/monthly.local.
  5. # To get section headers, use the function next_part in monthly.local.
  6. #
  7. umask 022
  8. PARTOUT=/var/log/monthly.part
  9. MAINOUT=/var/log/monthly.out
  10. install -o 0 -g 0 -m 600 /dev/null $PARTOUT
  11. install -o 0 -g 0 -m 600 -b /dev/null $MAINOUT
  12. start_part() {
  13. TITLE=$1
  14. exec > $PARTOUT 2>&1
  15. }
  16. end_part() {
  17. exec >> $MAINOUT 2>&1
  18. test -s $PARTOUT || return
  19. echo ""
  20. echo "$TITLE"
  21. cat $PARTOUT
  22. }
  23. next_part() {
  24. end_part
  25. start_part "$1"
  26. }
  27. run_script() {
  28. f=/etc/$1
  29. test -e $f || return
  30. if [ `stat -f '%Sp%u' $f | cut -b1,6,9,11-` != '---0' ]; then
  31. echo "$f has insecure permissions, skipping:"
  32. ls -l $f
  33. return
  34. fi
  35. . $f
  36. }
  37. start_part "Running monthly.local:"
  38. run_script "monthly.local"
  39. end_part
  40. rm -f $PARTOUT
  41. [ -s $MAINOUT ] && mail -s "`hostname` monthly output" root < $MAINOUT