Geek Side Blog‎ > ‎Archives‎ > ‎2008-vftgs‎ > ‎

Simple reporting script

posted Jul 24, 2011, 5:27 PM by Boyce Crownover   [ updated Jul 24, 2011, 5:28 PM ]
Wednesday, April 9, 2008, 03:05 PM
Posted by Administrator
I needed an easy way to get a report on what was going on on a Linux server, mostly just so we'd have an activity baseline.

I threw together this quick script to do it:

:~> cat bin/reportmaker.bash
#!/bin/bash
echo "<html><head><title>Report `date`</title></head><body>"
echo "<p>"
anchorct=0
for j in `find /proc -maxdepth 1 -type f 2>/dev/null | grep -Ev '.gz$'`
do
i=`basename $j`
var="cat $j|sed 's/^/$i: /'"
echo "Command: <a href=\"#anchor${anchorct}\">$var</a><br>"
let anchorct++
done
echo "</p>"

anchorct=0
for j in `find /proc -maxdepth 1 -type f 2>/dev/null | grep -Ev '.gz$'`
do
i=`basename $j`
var="cat $j|sed 's/^/$i: /'"
echo "<pre><a name=\"anchor${anchorct}\">$var</a>"
eval $var|cat -v
let anchorct++
echo "</pre>"
done
Comments