Annotation of researchv10no/cmd/uucp/uudemon.cleanu, revision 1.1

1.1     ! root        1: #!/bin/sh
        !             2: MAILTO=${mailto:-uucp}
        !             3: PATH=/bin:/usr/bin:/usr/lib/uucp
        !             4: export PATH
        !             5: TMP=/tmp/uu$$
        !             6: WISDOM=/tmp/uv$$
        !             7: >$WISDOM; chmod 0700 $WISDOM
        !             8: SPOOL=/usr/spool/uucp
        !             9: CORRUPT=/usr/spool/uucp/.Corrupt
        !            10: OLD=/usr/spool/uucp/.Old
        !            11: O_LOGS=$OLD/Old-Log
        !            12: 
        !            13: cd $SPOOL/.Admin
        !            14: mv xferstats audit errors Foreign $OLD
        !            15: >xferstats; >audit; >errors; >Foreign
        !            16: cd ..
        !            17: #
        !            18: # shuffle old log files back in name
        !            19: # $max controls the number kept
        !            20: # then catenate all the existing logfiles into a new old one
        !            21: #
        !            22: max=${1:-1}
        !            23: noisy=$2               # default not noisy
        !            24: case $noisy in
        !            25: "")    DOUBTFUL=/dev/null ;;
        !            26: *)     DOUBTFUL=$WISDOM ;;
        !            27: esac
        !            28: for i in `seq $max -1 2`
        !            29: do
        !            30:        j=`expr $i - 1`
        !            31:        mv ${O_LOGS}-$j ${O_LOGS}-$i
        !            32: done
        !            33: > ${O_LOGS}-1
        !            34: for i in uucico uucp uux uuxqt
        !            35: do
        !            36:        cd $SPOOL/.Log/$i
        !            37:        for j in *
        !            38:        do
        !            39:                case $j in
        !            40:                "*")
        !            41:                        break;;
        !            42:                esac
        !            43:                echo "********** $j **********" >> ${O_LOGS}-1
        !            44:                cat $j >> ${O_LOGS}-1
        !            45:                rm -f $j
        !            46:        done
        !            47: done
        !            48: cd $SPOOL
        !            49: uucleanup -D7 -C7 -X7 -o2 -W7
        !            50: mv .Admin/uucleanup $OLD/uucleanup
        !            51: if [ -s $OLD/uucleanup ]
        !            52: then
        !            53:        (echo "cleanup:"; cat $OLD/uucleanup) >>$DOUBTFUL
        !            54: fi
        !            55: >.Admin/uucleanup
        !            56: /usr/lib/uucp/uucrap           # remove empty directories, boring status
        !            57: find /usr/spool/uucppublic -type f -mtime +30 -exec rm -f "{}" \;
        !            58: find .Sequence -mtime +30 -exec rm -f "{}" \;
        !            59: find .Workspace .Status .Corrupt -type f -mtime +7 -exec rm -f "{}" \;
        !            60: 
        !            61: #
        !            62: # invent some status chatter
        !            63: #
        !            64: grep passwd ${O_LOGS}-1 > $TMP
        !            65: if [ -s $TMP ]
        !            66: then
        !            67:        (echo "passwd requests:"; cat $TMP) >>$WISDOM
        !            68: fi
        !            69: 
        !            70: awk '/(DENIED)/        {print prev; print $0}
        !            71:                {prev = $0}' ${O_LOGS}-1 > $TMP
        !            72: if [ -s $TMP ]
        !            73: then
        !            74:        (echo "denied:"; cat $TMP) >>$WISDOM
        !            75: fi
        !            76: ls .Corrupt > $TMP
        !            77: if [ -s $TMP ]
        !            78: then
        !            79:        (echo ".Corrupt:"; cat $TMP) >>$WISDOM
        !            80: fi
        !            81: tail $OLD/errors 2>/dev/null > $TMP
        !            82: tail $OLD/Foreign 2>/dev/null >> $TMP
        !            83: if [ -s $TMP ]
        !            84: then
        !            85:        (echo "Admin stuff:"; cat $TMP) >>$WISDOM
        !            86: fi
        !            87: if [ -s $WISDOM ]; then
        !            88:        mail $MAILTO <$WISDOM
        !            89: fi
        !            90: rm -f $WISDOM $TMP

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.