HylaFAX The world's most advanced open source fax server

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: [hylafax-users] MODEM Command Error



The mailing list didn't let me attach the .sh file.. renamed it to .txt
#!/bin/sh
#

XFERFAXLOG=/var/spool/fax/etc/xferfaxlog
FAXLOGDIR=/var/spool/fax/log
TEMPDIR=/tmp
ERROR_FILE=./errors.txt
LOG_FILE_NAME=$1

COUNTER=1
TOTAL=$(cat $ERROR_FILE | wc -l)
let TOTAL=TOTAL+1
while [ $COUNTER -lt $TOTAL ]; do
        CURRENT_ERROR=$(head -n $COUNTER errors.txt | tail -n 1)
        grep -i "$CURRENT_ERROR" $XFERFAXLOG | cut -c 21-29 > $TEMPDIR/output_$COUNTER.txt

        for i in $( cat $TEMPDIR/output_$COUNTER.txt ) ; do
                HOLD_DATE=$(grep "REMOTE TSI" $FAXLOGDIR/c$i | cut -c 1-18)
                HOLD_TSI=$(grep "REMOTE TSI" $FAXLOGDIR/c$i | cut -c 41-)
                echo "$CURRENT_ERROR - c$i - $HOLD_DATE - $HOLD_TSI" >> $LOG_FILE_NAME
        done

        rm $TEMPDIR/output_$COUNTER.txt
        let COUNTER=COUNTER+1
done



Project hosted by iFAX Solutions