home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 January / usenetsourcesnewsgroupsinfomagicjanuary1994.iso / sources / unix / volume11 / musbus / part02 / cleanup < prev    next >
Encoding:
Text File  |  1987-09-16  |  2.0 KB  |  109 lines

  1. #! /bin/sh
  2. #
  3. # $Header: cleanup,v 3.5 87/06/22 14:40:45 kjmcdonell Beta $
  4. #
  5. #  Cleanup when an iterative test terminates
  6. #
  7. log=Results/log
  8. while ( test $# -ge 1 )
  9. do
  10.     opt=$1
  11.     shift
  12.     case $opt
  13.     in
  14.  
  15.     -a)    : abort
  16.     echo '' >>$log
  17.     echo '**************************' >>$log
  18.     echo '* Benchmark Aborted .... *' >>$log
  19.     echo '**************************' >>$log
  20.     echo 'Benchmark Aborted ....'
  21.     echo  ; sleep 2 ; echo  ; sleep 2 ; echo 
  22.     echo "" >>$log
  23.     echo " " `who | wc -l` "interactive users." >>$log
  24.     echo "" >>$log
  25.     date=`date`
  26.     echo "End Benchmark Run ($date) ...." >>$log
  27.     echo "End Benchmark Run ($date) ...."
  28.     ;;
  29.  
  30.  
  31.     -f)    : filesystem throughput
  32.     awk -f fs.awk <$1 >>$log
  33.     rm -f $1
  34.     shift
  35.     ;;
  36.     
  37.     -i)    : report last iteration
  38.     echo "Terminated during iteration $1" >>$log
  39.     shift
  40.     ;;
  41.  
  42.     -l) : logfile
  43.     log=$1
  44.     shift
  45.     ;;
  46.     
  47.     -r) : reason for failure
  48.     echo $1
  49.     echo $1 >>$log
  50.     shift
  51.     ;;
  52.  
  53.     -m)    : mem throughput tests
  54.     awk -f mem.awk <$1 >>$log
  55.     rm -f $1
  56.     shift
  57.     ;;
  58.  
  59.     -t)    : timing with /bin/time
  60.     awk -f time.awk <$1 >>$log
  61.     rm -f $1
  62.     shift
  63.     ;;
  64.  
  65.     -w) : work - save information from multi-user test
  66.     worktmp=Tmp/work.tmp
  67.     for m in Tmp/masterlog.*
  68.     do
  69.         if ( test $m != "Tmp/masterlog.*" )
  70.         then
  71.         echo ${m}: >>$worktmp
  72.         cat $m >>$worktmp
  73.         echo "" >>$worktmp
  74.         rm -f $m
  75.         fi
  76.     done
  77.     for u in Tmp/userlog.*
  78.     do
  79.         if ( test $u != "Tmp/userlog.*" )
  80.         then
  81.         echo ${u}: >>$worktmp
  82.         cat $u >>$worktmp
  83.         echo "" >>$worktmp
  84.         rm -f $u
  85.         fi
  86.     done
  87.     PS1=`sh -ic "" 2>&1`
  88.     sed -e "s/\\${PS1}//g" $worktmp | sed -f check.sed >loggederrs
  89.     if ( test -s loggederrs )
  90.     then
  91.         echo "*************************************" >>$log
  92.         echo "* Apparent errors from makework ... *" >>$log
  93.         echo "*************************************" >>$log
  94.         cat loggederrs >>$log
  95.     fi
  96.         rm -f loggederrs
  97.     cat $worktmp >>${log}.work
  98.     rm -f $worktmp
  99.     ;;
  100.  
  101.     '')    : 'skip it (residual effect of shifts)'
  102.     ;;
  103.  
  104.     *)
  105.     echo "cleanup: bad option ($opt)" >>$log
  106. esac
  107. done
  108. exit
  109.