# # Script: topps_cumcpu_rmt # Where: in $FEDIR/scripts where $FEDIR=/apps/nns_com/fea # # Purpose: Runs 'ps' piped to 'awk' on a remote host. # # Usage: rsh $hostname_rmt topps_cumcpu_rmt $outfile-name # # Called by: $FEDIR/scripts/topps_cumcpu_anyhost # # Written by: B. Montandon 13Sep96 # Updated by: B. Montandon 28Oct96 added a prompt for a second image # Updated by: B. Montandon 23May97 used awk instead of cut to re-format # 'ps -ef' output WORKDIR="/local/scratch" echo " .....................`date`.............................. " >> $1 ps -ef | nawk 'BEGIN { } NR == 1 {next} $5 ~ /..:..:../ { # print $7 " " $1 " " $2 " " $3 " " $4 " " $5 " " $6 " " $8 printf ("%8s %-8s %5s %5s %1s %8s %-8s %s \n", $7, $1, $2, $3, $4, $5, $6, $8) # print "" next } $5 !~ /..:..:../ { # print $8 " " $1 " " $2 " " $3 " " $4 " " $5 " " $6 " " $7 " " $9 printf ("%8s %-8s %5s %5s %1s %3s %-4s %-8s %s \n", $8, $1, $2, $3, $4, $5, $6, $7, $9) # print "" next } ' | sort -t: +0nr -1 +1r -2 >> $1 echo " If you want a 2nd snapshot, enter 2 whenever you wish. Otherwise, press Enter to see one snapshot. (2/null) ==>${HIreset} \c" read ANOTHER if test "$ANOTHER" = "2" then echo " .....................`date`.............................. " >> $1 ps -ef | nawk 'BEGIN { } NR == 1 {next} $5 ~ /..:..:../ { # print $7 " " $1 " " $2 " " $3 " " $4 " " $5 " " $6 " " $8 printf ("%8s %-8s %5s %5s %1s %8s %-8s %s \n", $7, $1, $2, $3, $4, $5, $6, $8) # print "" next } $5 !~ /..:..:../ { # print $8 " " $1 " " $2 " " $3 " " $4 " " $5 " " $6 " " $7 " " $9 printf ("%8s %-8s %5s %5s %1s %3s %-4s %-8s %s \n", $8, $1, $2, $3, $4, $5, $6, $7, $9) # print "" next } ' | sort -t: +0nr -1 +1r -2 >> $1 fi