管理online的shell程序
源代码在线查看: check_db_access.sh.shtml
PRS Technologies, Inc. - script: check_db_access.sh 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; } --> defaultStatus = "PRS Technologies Inc. - script: check_db_access.sh"; Home Associates References Downloads Elite Links Contact Us check_db_access.sh ################################################################################ #!/usr/bin/ksh ################################################################################ # # Module: check_db_access.sh # Author: Peter R. Schmidt # Description: Check and log access to the database # Make 4 attempts per minute - each 15 seconds apart # # Arguments # # Argment: -v Interactive - display to screen - no e-mail # # Change Log # # Date Name Description................. # 09/03/02 Peter R. Schmidt Start Program # ################################################################################ FG=false for ARG do case "$ARG" in -v) FG=true;; esac done # Set the environment . /elite/custom/run.elite LOGDIR=/elite/work/logs LOGFILE=$LOGDIR/check_db_access.log TMPFILE=/tmp/check_db_access.log rm -f $TMPFILE if [ ! -d $LOGDIR ]; then echo "Error: check_db_access.sh: Directory: $LOGDIR does not exist!" exit 1 fi #------------------------------------------------------------------------------- for TRY in 1 2 3 4 # Make 4 attempts per minute - seach 15 seconds apart do UDATE=`date +%m/%d/%y` UTIME=`date +%H:%M:%S` # Try to access the database - log failures dbaccess son_db $TMPFILE EOF if [ $? != 0 ]; then echo "$UDATE $UTIME Fail" >> $LOGFILE cat $TMPFILE >> $LOGFILE if [ $FG = true ]; then tail -1 $LOGFILE cat $TMPFILE fi else echo "$UDATE $UTIME OK" >> $LOGFILE fi if [ $FG = true ]; then break else sleep 15 # Make 4 attempts per minute - seach 15 seconds apart fi done rm -f $TMPFILE ################################################################################ Home Associates References Downloads Elite Links Contact Us