-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi David,

Your absolutely right, I've been encrypting everything these days and I
didn't really think about what it would be like to help me and have to
jump through hoops just to see the file... Thanks.

David Fleck wrote:
| On Fri, 6 Aug 2004, Hakim Z. Singhji wrote:
|
|> You must import my public key to open the attached file.
|
|
| Why?  Why not just attach the plain file?
|
|
| --
| David Fleck
| [EMAIL PROTECTED]
|
|
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.4 (GNU/Linux)

iD4DBQFBFYQrlT9WV6TztkoRAvnkAJY6WeAm+pgtJc9SCQGS8fHt/3mcAKCElJ3t
nBkebGIh5g5yFbLXVCglmw==
=V05b
-----END PGP SIGNATURE-----
##############################################################################
#! /usr/bin/ksh                                                       
###############################################################################
#  CREATED_BY: Hakim Z. Singhji
###############################################################################
#  SCRIPT:  page_swap_mon.zsh                                                 
###############################################################################
#  DATE:  8/4/04                                                              
###############################################################################
#  VERSION: 0.1                                                               
###############################################################################
#  PLATFORM: Linux Only                                                       
###############################################################################
#  PURPOSE:  This shell script is used to produce a report of the system's swap 
#            of paging space statistics including: Total paging space in MB, MB 
#            of Free paging space Used, and % of paging space Free.             
###############################################################################
#  REV LIST:

#  set -x  # Uncomment to debug this shell script
#  set -n  # Uncomment to check command syntax without any execution
                                                        
###############################################################################
############################# DEFINE VARIABLES HERE ###########################

THISHOST=$(hostname)    # Host name of this machine
PC_LIMIT=65             # Upper limit of Swap space percentage before 
                        # notification 

###############################################################################
############################# INITIALIZE THE REPORT ###########################

echo "\nSwap Space Report for $THISHOST\n"
date

###############################################################################
############################# CAPTURE AND PROCESS DATE ########################
function swap_mon
{
free -m | grep -i swap | while read junk SW_TOTAL SW_USED SW_FREE

do 
        # Use the bc utility in a here document to calculate the percentage of 
        # free and used swap space

        PERCENT_USED=$(bc <<EOF
        scale=4
        ($SW_USED / $SW_TOTAL) * 100
        EOF
        )
        
        PERCENT_FREE=$(bc <<EOF
        scale=4
        ($SW_FREE / $SW_TOTAL) * 100
        EOF
        )
                
                # Produce the rest of the paging space report:
                echo "\nTotal Amount of Swap Space:\t${SW_TOTAL}MB"
                echo "Total KB of Swap Space Used:\t${SW_USED}MB"
                echo "Total KB of Swap Space Free:\t${SW_FREE}MB"
                echo "\nPercent of Swap Space Used:\t${PERCENT_USED}%"
                echo "\nPercent of Swap Space Free:\t${PERCENT_FREE}%"

                # Grab the integer portion of the percent used to test for
                # the over limit threshold

                INT_PERCENT_USED=$(echo $PERCENT_USED | cut -d. -f1)
                
                if (( PC_LIMIT <= INT_PERCENT_USED ))
                then 
                        # Swap space limit has exceeded th threshold, send
                        # notification

                        tput smso # TURN ON REVERSE VIDEO!!!!!!!!!
                        echo "\n\nWARNING: Paging Space has Exceeded the 
                        ${PC_LIMIT}% Upper Limit!\n"
                        tput rmso # TURN OFF REVERSE VIDEO!!!!!!!!!!!!!!
                fi
done

echo "\n"
}
###############################################################################
funtion paging_mon
{
###############################################################################
############################# DEFINE VARIABLES ################################

PAGING_STAT=/tmp/paing_stat.out # Paging Stat hold file

###############################################################################
############################# CAPTURE AND PROCESSING THE DATA #################

# Load the data in a file without the column headings

lsps -s | tail +2 > $PAGING_STAT

# Start a while loop and feed the loop from the bottom using the $PAGING_STAT 
# file as redirected input

while read TOTAL PERCENT
do 
        # Clean up the data by removing the suffixes
        PAGING_MB=$(echo $TOTAL | cut -d 'MB' -fi)
        PAGING_PC=$(echo $PERCENT | cut -d% -fi)

        # Calculate the missing data: %Free, MB used and MB free
        (( PAGINE_PC_FREE = 100 - PAGING_PC ))
        (( MB_USED = PAGING_MB * PAGING_PC / 100 ))
        (( MB_FREE = PAGING_MB - MB_USED ))

        # Procedure the rest of the paging space report:
        echo "\nTotal MB of Paging Space:\t$TOTAL"
        echo " Total MB of Paging Space Used: \t${MB_USED}MB"
        echo "Total MB of Paging Space Free: \t${MB_FREE}MB"
PAGING_STAT=/tmppagin_stat.out # Paging stat hold file

###############################################################################
#BELOW SEE THE ERROR MESSAGE DUE TO SHELL CONVERSION PROBLEMS

# [EMAIL PROTECTED] scripts]$ ./swap_mon.ksh
# \nSwap Space Report for redgate.ath.cx\n
# Fri Aug  6 00:04:14 EDT 2004
# ./swap_mon.ksh: line 1: bc: command not found
# ./swap_mon.ksh: line 1: bc: command not found
# \nTotal Amount of Swap Space:\t494MB
# Total KB of Swap Space Used:\t0MB
# Total KB of Swap Space Free:\t494MB
# \nPercent of Swap Space Used:\t%
# \nPercent of Swap Space Free:\t%
# \n
###############################################################################
############################# END OF FILE #####################################

Attachment: smime.p7s
Description: S/MIME Cryptographic Signature

Reply via email to