[BACK]Return to monthly CVS log [TXT][DIR] Up to [local] / src / etc

Annotation of src/etc/monthly, Revision 1.10

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