summary.sh revision 54359
154359Sroberto#!/bin/sh 254359Sroberto# 354359Sroberto# Script to summarize ipeerstats, loopstats and clockstats files 454359Sroberto# 554359Sroberto# This script can be run from a cron job once per day, week or month. It 654359Sroberto# runs the file-specific summary script and appends the summary data to 754359Sroberto# designated files. 854359Sroberto# 954359SrobertoDATE=`date +19%y%m%d` 1054359SrobertoS=/usr/local/bin/S 1154359SrobertoSIN=S.in 1254359SrobertoSOUT=S.out 1354359SrobertoLOOP=loop_summary 1454359SrobertoPEER=peer_summary 1554359SrobertoCLOCK=clock_summary 1654359Sroberto 1754359Srobertorm -f $SIN $SOUT 1854359Sroberto 1954359Sroberto# 2054359Sroberto# Summarize loopstats files 2154359Sroberto# 2254359Srobertofor f in loopstats.[12][0-9][0-9][0-9][0-1][0-9][0-3][0-9]; do 2354359Sroberto d=`echo $f | cut -f2 -d.` 2454359Sroberto if [ -f $f ] && [ $DATE != $d ]; then 2554359Sroberto echo " " >>$LOOP 2654359Sroberto echo $f >>$LOOP 2754359Sroberto awk -f loop.awk $f >>$LOOP 2854359Sroberto if [ -f $S ]; then 2954359Sroberto echo "file1<-"\"${f}\" >>$SIN 3054359Sroberto echo "source("\""loop.S"\"")" >>$SIN 3154359Sroberto echo "unix("\""rm ${f}"\"")" >>$SIN 3254359Sroberto else 3354359Sroberto rm -f $f 3454359Sroberto fi 3554359Sroberto fi 3654359Srobertodone 3754359Sroberto 3854359Sroberto# 3954359Sroberto# Summarize peerstats files 4054359Sroberto# 4154359Srobertofor f in peerstats.199[4-9][0-1][0-9][0-3][0-9]; do 4254359Sroberto d=`echo $f | cut -f2 -d.` 4354359Sroberto if [ -f $f ] && [ $DATE != $d ]; then 4454359Sroberto echo " " >>$PEER 4554359Sroberto echo $f >>$PEER 4654359Sroberto awk -f peer.awk $f >>$PEER 4754359Sroberto rm -f $f 4854359Sroberto fi 4954359Srobertodone 5054359Sroberto 5154359Sroberto# 5254359Sroberto# Summarize clockstats files 5354359Sroberto# 5454359Srobertofor f in clockstats.199[4-9][0-1][0-9][0-3][0-9]; do 5554359Sroberto d=`echo $f | cut -f2 -d.` 5654359Sroberto if [ -f $f ] && [ $DATE != $d ]; then 5754359Sroberto echo " " >>$CLOCK 5854359Sroberto echo $f >>$CLOCK 5954359Sroberto awk -f clock.awk $f >>$CLOCK 6054359Sroberto if [ -f /dev/gps[0-9] ]; then 6154359Sroberto awk -f itf.awk $f >itf.$d 6254359Sroberto awk -f etf.awk $f >etf.$d 6354359Sroberto awk -f ensemble.awk $f >ensemble.$d 6454359Sroberto awk -f tdata.awk $f >tdata.$d 6554359Sroberto fi 6654359Sroberto rm -f $f 6754359Sroberto fi 6854359Srobertodone 6954359Sroberto 7054359Sroberto# 7154359Sroberto# Process clockstat files with S and generate PostScript plots 7254359Sroberto# 7354359Srobertofor f in itf etf ensemble tdata; do 7454359Sroberto for d in ${f}.199[4-9][0-1][0-9][0-3][0-9]; do 7554359Sroberto if [ -f $d ]; then 7654359Sroberto if [ -f $S ]; then 7754359Sroberto echo "file1<-"\"${d}\" >>$SIN 7854359Sroberto echo "source("\"${f}.S\"")" >>$SIN 7954359Sroberto echo "unix("\""rm ${d}"\"")" >>$SIN 8054359Sroberto else 8154359Sroberto rm -f $d 8254359Sroberto fi 8354359Sroberto fi 8454359Sroberto done 8554359Srobertodone 8654359Srobertoif [ -f $SIN ]; then 8754359Sroberto $S BATCH $SIN $SOUT 8854359Srobertofi 89