2 ################################################################################
5 # Description: This is the daily cronjob for root
6 # Author: Andrew@DeFaria.com
7 # Created: Wed Jul 21 12:12:28 PDT 1999
11 # (c) Copyright 2001, Andrew@DeFaria.com, all rights reserved
13 ################################################################################
17 adm_base=${adm_base:-$HOME/adm}
20 adm_fpath=${adm_fpath:-$adm_base/functions}
25 # Add $adm_base/bin and $adm_base/clearcase PATH
26 export PATH=$adm_base/bin:$adm_base/clearcase:$PATH
28 # Source in tmpfiles function
29 tmpprefix=${TMPDIR:-/tmp}/$me.$$
37 # Define admin_host. Admin_host is the machine where checks for the network
38 # as a whole are run (such as check_view_storage)
39 admin_host=dreamcicle # For now...
45 display "$me [-v|verbose] [-d|debug] [-u|usage] [-n|notify <email address>]"
46 display " -v|verbose: Turns on verbose mode"
47 display " -d|debug: Turns on debug mode"
48 display " -u|usage: Print this usage message\n"
49 display " -n|notify: Who to notify of problems (default root)"
54 lab_admin=cdsadmin # For now
63 Notice: $me cronjob discovered the following problems:
67 cat $logfile >> $tmpfile
69 mailx -s "Notice: $me cronjob discovered the following problems" $who <
75 while [ $# -ge 1 ]; do
92 error "Notify email address was unspecified!" 1
98 usage "Unrecognized parameter $1"
105 # Some common portions of log filenames:
106 host=$(uname -n) # System's name
107 date=$(date +%d) # Note we keep one month of rolling logs
109 if [ "$host" = "$admin_host" ]; then
110 network_diskspace_log=$logs/network.diskspace.$date.log
111 verbose "Diskspace Report -> $network_diskspace_log"
112 diskspace -network > $network_diskspace_log 2>&1
114 if [ -s $network_diskspace_log ]; then
115 notify $lab_admin $network_diskspace_log
118 view_storage_log=$logs/viewstorage.$date.log
119 verbose "View Storage Report -> $view_storage_log"
120 check_view_storage > $view_storage_log 2>&1
122 if [ -s $view_storage_log ]; then
123 notify $lab_admin $view_storage_log
126 # Produce a viewspace report for all production view servers
127 viewservers="cds-sundev-rem canon"
129 for viewserver in $viewservers; do
130 viewspace_log=$logs/$viewserver.viewspace.$date.log
131 verbose "Viewspace Report for $viewserver -> $viewspace_log"
132 viewspace -host $viewserver > $viewspace_log
136 # Checks run on all machines
137 local_diskspace_log=$logs/$host.diskspace.$date.log
138 verbose "Diskspace Report -> $local_diskspace_log"
139 diskspace -local > $local_diskspace_log 2>&1
141 if [ -s $local_diskspace_log ]; then
142 notify local_admin $local_diskspace_log
145 machine_configuration_log=$logs/$host.machine_configuration.$date.log
146 verbose "Machine Configuration Report -> $machine_configuration_log" 2>&1 &
147 configure_machine -f > $machine_configuraton_log 2>&1
149 if [ -s $machine_configuration_log ]; then
150 notify local_admin $machine_configuration_log