# seismon - monitor SeisWorks processes for
# inactivity since SeisWorks doesn't support
# FlexLMs TIMEOUT facility
# run by cron every half hour
# Put a blank line and the date into the log file
echo "" >> $HOME/lmk/seismon.out
date >> $HOME/lmk/seismon.out
# Define temporary work area - not /tmp since this is cleared
# on reboot and we need to hold on to the files..
TMPDIR=$HOME/lmk/seismon.tmpdir;export TMPDIR
# Specify the list of servers to monitor
serverlist="lnst0aa lnst1a lnst2a lnst3a lnst4a lnst5a lnlm06a lnlm08"
# Loop through all servers
for server in $serverlist; do
# check that the server is alive
# If it is not then continue with the next one
/usr/etc/ping $server >/dev/null
[ $? -ne 0 ] && continue
# Th server is alive so find all relevant processes running
# on it and print out a sorted list of pid, uid, cpu_time
# and process_name
rsh $server ps -axuww|nawk '$0~/Seis.d$/ \
{print substr($0,10,5), substr($0,1,9), \
substr($0,50,6),$NF}' | \
sort > $TEMPDIR/seismon.$server.new
# Join the old and new lists and print out uid and \
# process_name if there is no change in cpu time
join $TMPDIR/seismon.$server.old $TMPDIR/seismon.$server.new \
| nawk '$3==$6 {print "'$server'",$2,$4}'>> \
$HOME/lmk/seismon.out
# Rename new output to old
mv $TMPDIR/seismon.$server.new $TMPDIR.seismon.$server.old
done
Click here to comment on this article
© Oil IT Journal - all rights reserved.