Apache serverio log failo analizė programa

Referatas
 5
Microsoft Word 35 KB
4 puslapiai

#!/bin/sh
DIALOG=${DIALOG=dialog}

declare bytes_in_gb=1048576
declare procentai=100

laikinas=TMP
laikinas2=TMP2

declare -a lines
declare -a bytesamount


processLine(){
line="$@"
}

if [ "$1" == "" ]; then
$DIALOG --title "DUOMENU NUSKAITYMAS" \
--inputbox "Iveskite log failo pavadinima:" 18 45 2> /tmp/inputbox.tmp.$$
retval=$?
input=`cat /tmp/inputbox.tmp.$$`
rm -f /tmp/inputbox.tmp.$$

case $retval in
0)
echo "Input string is '$input'";;
1)
echo "Cancel pressed.";;
255)
echo "Box closed.";;
esac
inputfile="$input"

if [ ! -f $inputfile ]; then
$DIALOG --title "ERRROR" \
--msgbox "$inputfile : neegzistuoja" > "/dev/stderr" 10 40
case $? in
0)
echo "OK";;
255)
echo "Box closed.";;
esac
exit 1
elif [ ! -r $inputfile ]; then
$DIALOG --title "ERRROR" \
--msgbox "$inputfile: neimanoma nuskaityti" > "/dev/stderr" 10 40
case $? in
0)
echo "OK";;
255)
echo "Box closed.";;
esac
exit 2
fi

elif [ "$1" == "--help" ]; then
$DIALOG --title "HELP" \
--msgbox "Programos paleidimas:\n
sh n.sh\n
sh n.sh log\n
\n
\n
\n
\n
created By Nerijus Kliauba " 15 50
case $? in
0)
echo "OK";;
255)
echo "Box closed.";;
esac
exit
else
inputfile=$1
if [ ! -f $inputfile ]; then
$DIALOG --title "ERRROR" \
--msgbox "$inputfile : neegzistuoja" > "/dev/stderr" 10 40
case $? in
0)
echo "OK";;
255)
echo "Box closed.";;
esac
exit 1
elif [ ! -r $inputfile ]; then
$DIALOG --title "ERRROR" \
--msgbox "$inputfile: neimanoma nuskaityti" > "/dev/stderr" 10 40
case $? in
0)
echo "OK";;
255)
echo "Box closed.";;
esac
exit 2
fi
fi
#--------------------------------------------------------------------------

d=0
until [ $d = 1 ];
do

$DIALOG --clear --radiolist "MENIU" 15 90 8 \
"1" "Narsykliu statistika" off \
"2" "OS daznumas procentais " off \
"3" "Operacines sistemos" off \
"4" "Kiek duomenu persiunte serveris" off \
"5" "Kokius metodus naudojo kiekvienas IP" off \
"6" "Kiekvieno lankytojo persiustas kiekis duomenu" off \
"7" "Suvestine" off \
"8" "Iseiti" off 2>/tmp/tmp.$$
input=`cat /tmp/tmp.$$`

case $input in
#----------------------------------------------------------------------------------------------------
1)
rezultfile="IE"
rezultfile2="IEPROC"
echo "">$rezultfile
echo "">$rezultfile2
echo "">$laikinas

zcat $inputfile | grep "Mozilla/4.0" | grep "(compatible;" |grep "MSIE" | cut -f14,15 -d " " | sort | uniq -c | sort -g -r>>$laikinas
zcat...