Cover V05, I12
Article
Listing 1
Listing 2
Listing 3
Listing 4

dec96.tar


Listing 4: proaccess.exp

# Next comes the proaccess.exp script.  This script starts a user
# session in the database, notes how long it took, and then exits. It
# produces a log file that looks like this:
# -------------------------------------------------------------------
# 10/03/96 14:31:53 3
# 10/03/96 14:36:54 1
# 10/03/96 14:41:56 5
# 10/03/96 14:46:57 8
# 10/03/96 14:51:58 6
# 10/03/96 14:56:59 5
# 10/03/96 15:02:00 3
# 10/03/96 15:07:01 1
# 10/03/96 15:12:02 1
# -------------------------------------------------------------------

#!/opt/gnu/bin/expect --
# proaccess.exp

#
# This script monitors PROGRESS database performance by simulating a
# single user logging into the database every 5 minutes.  The actual
# time it takes to start the session is measured and written to a
# log file.
#

#
# First, I tell expect not to time out on reads, and not to display
# progress output to stdout.
#

set timeout -1
log_user 0

#
# Next, I create a log file with a time-stamp embedded in the name.
#

set home_dir [set env(HOME)]
set out_file "$home_dir/logs/proaccess.exp_[ timestamp -format
"%y%m%d_%H%M%S" ]"
set log_file [ open $out_file "w" ]

#
# By tradition, the executables that make up the Progress RDBMS are
# kept in a directory referenced by the $DLC envirnonment variable.
#

set dlc [set env(DLC)]

#
# I choose to set the database name explicitly, since it never
# changes.
#

set dbname "/progdb/progfs05/d1prod"

#
# Start a "while" loop which spawns a progress user session every
# 5 minutes, times it, and then terminates it.  The string
# "F8=CLOSE" is the last thing Progress displays when it opens up
# a new screen.
#

while 1 {
set a [timestamp]

spawn "$dlc/bin/_progres" $dbname

expect "F8=CLOSE"
set b [timestamp]

send "quit\030"

set c [ expr $b - $a ]
set time_stamp [ timestamp -format "%D %X" ]
puts $log_file "$time_stamp $c"
flush $log_file

sleep 300
}

#
# proaccess.exp ends here

# End of File