⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 check_new_segments.sh.shtml

📁 管理online的shell程序
💻 SHTML
字号:
<HTML><HEAD><TITLE>PRS Technologies, Inc. - script: check_new_segments.sh</TITLE><META NAME="Description" content="PRS Technologies Inc. - Check to see if any new Informix shared memory virtual segments have been added"><STYLE TYPE="text/css"><!--A.CLASS1 {background-color: #000066;  color: white;  letter-spacing: 0.2ex;  font-size: 14pt;  text-decoration: none;}A:hover.CLASS1 {  background-color: #ffffcc;  color: black;}--></STYLE><SCRIPT>defaultStatus = "PRS Technologies Inc. - script: check_new_segments.sh";</SCRIPT></HEAD></CENTER><CENTER><TABLE border=0 cellspacing=0 cellpadding=0 width=90%><TR><TD>      <CENTER>      <IMG SRC="../gif/prs_tech_top_of_page1.gif" border=0 align=center alt="PRS Technologies Home Page">      </CENTER></TD></TR><TR><TD>      <CENTER>      <TABLE border=2 cellspacing=0 cellpadding=0>      <TR>      <td><A HREF="../index.shtml"          CLASS=CLASS1>&#160;Home&#160;</A>      <td><A HREF="../resume.shtml"         CLASS=CLASS1>&#160;Associates&#160;</A>      <td><A HREF="../references.shtml"     CLASS=CLASS1>&#160;References&#160;</A>      <td><A HREF="../downloads.shtml"      CLASS=CLASS1>&#160;Downloads&#160;</A>      <td><A HREF="../elite1.shtml"         CLASS=CLASS1>&#160;Elite&#160;</A>      <td><A HREF="../links.shtml"          CLASS=CLASS1>&#160;Links&#160;</A>      <td><A HREF="../contacts.shtml"       CLASS=CLASS1>&#160;Contact&nbspUs&#160;</A>      </TR>      </TABLE>      </CENTER></TD></TR></TABLE></CENTER><BR><CENTER><TABLE border=4 cellpadding=4 bgcolor=cornsilk><tr><td><font color=blue size=+2><B>check_new_segments.sh</B></font></td></tr></table></CENTER><XMP>#!/bin/sh#################################################################################   Module:         check_new_segments.sh#   Author:         Peter R. Schmidt#	#	Description:	##	Check to see if any new Informix shared memory virtual segments have been added.##   Change Log##    Date       Who		Description##  10/17/2000	Peter Schmidt	Start Program#  02/20/2001   Peter Schmidt   Make sure Informix is up and the previous file exists ($LASTCNT > 0)#################################################################################EXCLUDE_LIST1="^$|^TIMESTAMP:|Informix Dynamic|Segment Summary|Total\:|class blkused  blkfree|locked in memory"#-------------------------------------------------------------------------------# Set the Informix environment#-------------------------------------------------------------------------------ENV_FILE=/usr/local/bin/setenv.shif [ -x $ENV_FILE ]then	. $ENV_FILE > /dev/nullelse	echo "Error: the file used to set the Informix environment does not exist!"	echo "The missing filename is: $ENV_FILE"	exit 1fiif [ "x$INFORMIXDIR" = "x" ]	# Is my environment already set ?then	# Note: You can set the Informix environment several ways.	#       You can hardcode it here - or else you can set it using a file.	#       If you hardcode it here, it would look something like this...	#	#export INFORMIXDIR=/opt/informix	#export INFORMIXSERVER=myserver_shm	#export ONCONFIG=onconfig.myserver	# If you set it using a file, it might look like this...	ENV_FILE=/usr/local/bin/setenv.sh	if [ -x $ENV_FILE ]	then			. $ENV_FILE 	else			echo "Error: the file used to set the Informix environment does not exist!"			echo "The missing filename is: $ENV_FILE"			exit 1	fifiINFORMIXHOME=${INFORMIXHOME:-"/home/informix"}LASTTIME=$INFORMIXHOME/logs/onstat_g_seg.lastTHISTIME=$INFORMIXHOME/logs/onstat_g_seg.new#-------------------------------------------------------------------------------#  Check to make sure this directory exists#-------------------------------------------------------------------------------if [ ! -d $INFORMIXHOME/logs ]then	echo "Error: $0: the directory $INFORMIXHOME does not exist!"	echo "I don't know where to put the output from the last onstat -g seg."	exit 1fi#-------------------------------------------------------------------------------#  Make sure the instance is up. If not - then just exit.#-------------------------------------------------------------------------------if [ `$INFORMIXDIR/bin/onstat 2>&- | /usr/bin/grep -c "not initialized"` -ne 0 ]then        exit 0fi#-------------------------------------------------------------------------------#  Get previous number of virtual segments#-------------------------------------------------------------------------------LASTCNT=0if [ -f $LASTTIME ]then	for CLASS in `cat $LASTTIME | egrep -v "$EXCLUDE_LIST1" | awk '{print $6}'`	do		if [ $CLASS = "V" ]		then			LASTCNT=`expr $LASTCNT + 1`		fi	done fi#-------------------------------------------------------------------------------#  Save latest number of segments#-------------------------------------------------------------------------------NEWDATE=`date`echo "TIMESTAMP: $NEWDATE" > $THISTIMEonstat -g seg >> $THISTIME#-------------------------------------------------------------------------------#  Get the latest number of virtual segments#-------------------------------------------------------------------------------NEWCNT=0for CLASS in `cat $THISTIME | egrep -v "$EXCLUDE_LIST1" | awk '{print $6}'`do	if [ $CLASS = "V" ]	then		export NEWCNT=`expr $NEWCNT + 1`	fidone #-------------------------------------------------------------------------------#  Compare the counts#-------------------------------------------------------------------------------if [ $NEWCNT -gt $LASTCNT -a $LASTCNT -gt 0 ]then	echo "Attention: the number of Informix shared memory Virtual segments has increased!"	echo	echo "The Virtual segment count increased from $LASTCNT to $NEWCNT"	echo	echo "--------------------------------------------------------------------------------"	echo "PREVIOUS segment summary"	cat $LASTTIME	echo "--------------------------------------------------------------------------------"	echo "LATEST segment summary"	cat $THISTIME	echo "--------------------------------------------------------------------------------"	echofi#-------------------------------------------------------------------------------#  Replace the file for the next check#  Note: if the NEW count is smaller then the LAST count, that implies #  that the Informix engine was bounced or segments were freed up. No problem.#-------------------------------------------------------------------------------rm -f $LASTTIMEmv $THISTIME $LASTTIME</XMP><CENTER><TABLE border=2 cellspacing=0 cellpadding=0><TR><td><A HREF="../index.shtml"        CLASS=CLASS1>&#160;Home&#160;</A><td><A HREF="../resume.shtml"       CLASS=CLASS1>&#160;Associates&#160;</A><td><A HREF="../references.shtml"   CLASS=CLASS1>&#160;References&#160;</A><td><A HREF="../downloads.shtml"    CLASS=CLASS1>&#160;Downloads&#160;</A><td><A HREF="../elite1.shtml"       CLASS=CLASS1>&#160;Elite&#160;</A><td><A HREF="../links.shtml"        CLASS=CLASS1>&#160;Links&#160;</A><td><A HREF="../contacts.shtml"     CLASS=CLASS1>&#160;Contact&nbspUs&#160;</A></TR></TABLE></CENTER></BODY></HTML>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -