All pastes #278304 Raw Edit

Unnamed

public shellscript v1 · immutable
·published 2006-12-13 23:37 UTC
rendered paste body
#!/bin/shecho -ne "Content-type: text/html\r\n\r\n"echo "<HTML><BODY>"cd ~steam/steam/tfc/tfc/logs/echo "<TABLE border="1">"echo "<TR><TH>Logfile <TH>Map <TH>Size <TH>Start <TH>Length <TH>View stats <TH>Create stats"for logfile in $(find *.log -size +20k | sort -r)do	stats="$(stat $logfile)"	size=$(echo "$stats" | grep Size | awk '{print $2}')	#date=$(echo "$stats" | grep Access | awk '{print $2 }')	#time=$(echo "$stats" | grep Access | awk '{print $3 }')	date=$(cat $logfile | grep "^L" | head -n1 | awk '{print $2}')	time=$(cat $logfile | grep "^L" | head -n1 | awk '{print $4}' | cut -c 0-8)	start=$(date -d "$date $time" +"%d.%m.%y %T")	enddate=$(cat $logfile | grep "^L" | tail -n1 | awk '{print $2}')	endtime=$(cat $logfile | grep "^L" | tail -n1 | awk '{print $4}' | cut -c 0-8)	secondsStart=$(date -d "$date $time" +%s)	secondsEnd=$(date -d "$date $endtime" +%s)	timespan=$(echo $secondsEnd-$secondsStart | bc)	timespanMinutes=$(echo "$timespan / 60" | bc)	timespanSeconds=$(echo "$timespan % 60" | bc)		if [ "$(echo "length($timespanSeconds)" | bc)" = "1" ] 	then		timespanSeconds="0$timespanSeconds"	fi	map=$(grep -m1 "Started map" $logfile | awk '{print $7}' | cut -d \" -f2)	echo "<TR><TD><A href="getlog.cgi?log=$logfile">$logfile</A>"	echo "<TD>$map <TD align="right">$size <TD>$start <TD align="right">$timespanMinutes:$timespanSeconds"		if [ -d /var/www/logs/$logfile ]	then		echo "<TD> <A href="/logs/$logfile">view</A>"	else		echo "<TD>"	fi	echo "<TD> <A href="/cgi-bin/logs/admin/createlog.cgi?log=$logfile">create</A>"doneecho "</TABLE>"echo "</BODY></HTML>"