#! /bin/csh -f # Last edited on 2008-02-04 17:13:38 by stolfi set usage = "$0 [-debug]" # Checks the state of all LAD machines and appends the reports # to appropriate files in directory ${STOLFIHOME}/lad-watch/YYYY-MM-DD/. set debug = 0 set mchopts = ( ) while ( ( $#argv > 0 ) && ( "/$1" =~ /-* ) ) if ( ( $#argv >= 1 ) && ( "/$1" == "/-debug" ) ) then set debug = 1; set mchopts = ( ${mchopts} "$1" ); shift else echo "usage: ${usage}"; exit 1 endif end if ( $#argv != 0 ) then echo "usage: ${usage}"; exit 1 endif set day = `date '+%Y-%m-%d'` set logdir = "${STOLFIHOME}/lad-watch/${day}" if ( ! ( -d ${logdir} ) ) then mkdir ${logdir} endif foreach mo ( \ anta.lad/osf-1 \ cotia.lad/osf-2 \ tatu.lad/linux \ guara1.lad/linux \ guara2.lad/linux \ jaguatirica.lad/solaris \ amelia/linux \ ) if ( $debug ) echo "${mo}" set mch = "${mo:h}" set os = "${mo:t}" set logfile = "${logdir}/${day}-${mch}.log" if ( "/${os}" == "/osf-1" ) then set cmd = "top -b -d 1 50" else if ( "/${os}" == "/solaris" ) then set cmd = "top -b -d 1 50" else if ( "/${os}" == "/linux" ) then set cmd = "top -b -n 1" else echo "unknown OS type: ${os}" endif if ( $debug ) then ${STOLFIHOME}/bin/check-machine-status ${mchopts} \ ${mch}.ic.unicamp.br "${cmd}" \ | ${STOLFIHOME}/bin/cleanup-top-output else ${STOLFIHOME}/bin/check-machine-status ${mchopts} \ ${mch}.ic.unicamp.br "${cmd}" \ | ${STOLFIHOME}/bin/cleanup-top-output \ >>& ${logfile} & endif end