Simple reporting script

Post date: Jul 25, 2011 12:27:56 AM

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