periodic.sh.patch

josepht1, 12/09/2009 04:41 PM

Download (2.05 KB)

View differences:

usr.sbin/periodic/periodic.sh
39 39
    # Where's our output going ?
40 40
    eval output=\$${arg##*/}_output
41 41
    case "$output" in
42
    /*) pipe="cat >>$output";;
43
    "") pipe=cat;;
44
    *)  pipe="mail -s '$host ${arg##*/} run output' $output";;
42
    /*) pipe="cat >>$output"
43
        verbose=YES
44
        ;;
45
    "") pipe=cat
46
        verbose=YES
47
        ;;
48
    *)  pipe="mail -s '$host ${arg##*/} run output' $output"
49
        verbose=NO
50
        ;;
45 51
    esac
46 52

  
47 53
    success=YES info=YES badconfig=NO	# Defaults when ${run}_* aren't YES/NO
48
    for var in success info badconfig
54
    for var in success info badconfig verbose
49 55
    do
50 56
        case $(eval echo "\$${arg##*/}_show_$var") in
51 57
        [Yy][Ee][Ss]) eval $var=YES;;
......
71 77
    {
72 78
        empty=TRUE
73 79
        processed=0
74
        echo "-- Start of $arg output -- `date`"
80
        if [ $verbose = YES ]
81
        then
82
            echo "-- Start of $arg output -- `date`"
83
        fi
75 84
        for dir in $dirlist
76 85
        do
77 86
            for file in $dir/*
......
79 88
                if [ -x $file -a ! -d $file ]
80 89
                then
81 90
                    output=TRUE
82
                    echo "-- Start of $arg $file output -- `date`"
91
                    if [ $verbose = YES ]
92
                    then
93
                        echo "-- Start of $arg $file output -- `date`"
94
                    fi
83 95
                    processed=$(($processed + 1))
84 96
                    $file </dev/null >$tmp_output 2>&1
85 97
                    rc=$?
......
101 113
          [ $processed = 1 ] && plural= || plural=s
102 114
          echo "No output from the $processed file$plural processed"
103 115
        else
104
          echo ""
105
          echo "-- End of $arg output -- `date`"
116
          if [ $verbose = YES ]
117
          then
118
            echo ""
119
            echo "-- End of $arg output -- `date`"
120
          fi
106 121
        fi
107 122
    } | eval $pipe
108 123
done