Initial add of defaria.com
[clearscm.git] / defaria.com / Computers / code / adm / bin / machine_stats
1 #!/bin/bash
2 ################################################################################
3 #
4 # File:         machine_stats
5 # Description:  Displays statistical information about all machines
6 # Author:       Andrew@DeFaria.com
7 # Created:      Fri Apr 30 14:13:56 PDT 1999
8 # Language:     Korn Shell
9 #
10 # (c) Copyright 2001, Andrew@DeFaria.com, all rights reserved
11 #
12 ################################################################################
13 # Set me to command name
14 me=$(basename $0)
15
16 # Set adm_base
17 adm_base=${adm_base:-//sonscentral/Corporate/Software/adm}
18
19 # Set adm_fpath
20 adm_fpath=${adm_fpath:-$adm_base/functions}
21
22 # Source functions
23 . $adm_fpath/common
24
25 # Set machines
26 machines=${machines:-$adm_base/data/machines}
27
28 if [ ! -f $machines ]; then
29   echo "$me: Error: Unable to find $machines file!"
30   exit 1
31 fi
32
33 total_machines=$(grep -cv "^#" $machines)
34 total_XP=$(grep -v "^#" $machines | grep -c "NT-5.1")
35 total_2000=$(grep -v "^#" $machines | grep -c "NT-5.0")
36 total_NT4_0=$(grep -v "^#" $machines | grep -c "NT-4.0")
37 total_cc=$(grep -v "^#" $machines | grep -c "4\.1\:")
38
39 echo "Machine breakdown"
40 echo --------------------------------
41 echo "Total Windows XP.............. $total_XP"
42 echo "Total Windows 2000 Pro........ $total_2000"
43 echo "Total Windows NT 4.0.......... $total_NT4_0"
44 echo "Total Clearcase............... $total_cc"
45 echo "Total Machines ............... $total_machines"