#!/bin/sh echo -ne "Content-type: text/html\r\n\r\n" echo "
| Logfile | Map | Size | Start | Length | View stats | Create stats" for logfile in $(find *.log -size +30k | sort -r) do stats="$(stat $logfile)" size=$(echo "$stats" | grep Size | awk '{print $2}') dateTime=$(grep -m1 "^L" $logfile | awk '{print $2 " " $4}' | cut -c 0-19) start=$(date -d "$dateTime" +"%d.%m.%y %T") endDateTime=$(grep "^L" $logfile | tail -n1 | awk '{print $2 " " $4}' | cut -c 0-19) secondsStart=$(date -d "$dateTime" +%s) secondsEnd=$(date -d "$endDateTime" +%s) timespanMinutes=$(echo "($secondsEnd-$secondsStart) / 60" | bc) timespanSeconds=$(echo "($secondsEnd-$secondsStart) % 60" | bc) if [ "$timespanSeconds" -lt 10 ] then timespanSeconds="0$timespanSeconds" fi map=$(grep -m1 "Started map" $logfile | awk '{print $7}' | cut -d \" -f2) echo " | |
|---|---|---|---|---|---|---|---|
| $logfile" echo " | $map | $size | $start | $timespanMinutes:$timespanSeconds" if [ -d /var/www/logs/$logfile ] then echo " | view" else echo " | " fi echo " | create" done echo " |