View Single Post
  #7   (View Single Post)  
Old 24th December 2008
J65nko J65nko is offline
Administrator
 
Join Date: May 2008
Location: Budel - the Netherlands
Posts: 4,131
Default

Each sequence of commands that you repeat a couple of times can be scripted. Not only configuring can be automated. Actually reporting is a more thankful target for automating.

For instance:
Code:
#!/bin/sh

HOMES=" \
/home/j65nko
/home/john
/home/robert
/home/packages
"
CMD="du -ks"
# -k    : blocks of 1024 bytes
# -s    : grand total only (no individial files)

echo "Home directory usage on $(uname -n)"
date
echo "==============================================="

${CMD} ${HOMES} | awk '{ total += $1 ;
                         printf "%-30s : %10u\n", $2, $1 ;
                        } END { printf "%+30s : %10u\n", "TOTAL", total }'
A sample run
Code:
$ sudo home-usage                            
Home directory usage on hercules.utp.xnet
Wed Dec 24 02:30:50 CET 2008
===============================================
/home/j65nko                   :    5829316
/home/john                     :       2686
/home/robert                   :         20
/home/packages                 :     262100
                         TOTAL :    6094122
__________________
You don't need to be a genius to debug a pf.conf firewall ruleset, you just need the guts to run tcpdump
Reply With Quote