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