Date: Sat, 07 Aug 2004 21:38:52 -0400 From: "Hakim Z. Singhji" <hakim.singhji@earthlink.net> To: David Fleck <david.fleck@mchsi.com> Cc: questions@freebsd.org Subject: Re: Help Debugging Kshell Script??? Message-ID: <4115842C.2090907@earthlink.net> In-Reply-To: <20040806161222.O275@grond.sourballs.org> References: <411318A8.4080100@earthlink.net> <20040806161222.O275@grond.sourballs.org>
next in thread | previous in thread | raw e-mail | index | archive | help
This is a cryptographically signed message in MIME format. --------------ms090909040905050501070401 Content-Type: multipart/mixed; boundary="------------040308070300080301090406" This is a multi-part message in MIME format. --------------040308070300080301090406 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit -----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 | david.fleck@mchsi.com | | -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.4 (GNU/Linux) iD4DBQFBFYQrlT9WV6TztkoRAvnkAJY6WeAm+pgtJc9SCQGS8fHt/3mcAKCElJ3t nBkebGIh5g5yFbLXVCglmw== =V05b -----END PGP SIGNATURE----- --------------040308070300080301090406 Content-Type: text/plain; name="swap_mon.ksh" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="swap_mon.ksh" ############################################################################## #! /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 # [hakim@redgate 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 ##################################### --------------040308070300080301090406-- --------------ms090909040905050501070401 Content-Type: application/x-pkcs7-signature; name="smime.p7s" Content-Transfer-Encoding: base64 Content-Disposition: attachment; filename="smime.p7s" Content-Description: S/MIME Cryptographic Signature MIAGCSqGSIb3DQEHAqCAMIACAQExCzAJBgUrDgMCGgUAMIAGCSqGSIb3DQEHAQAAoIIJQzCC AvwwggJloAMCAQICAwy3+jANBgkqhkiG9w0BAQQFADBiMQswCQYDVQQGEwJaQTElMCMGA1UE ChMcVGhhd3RlIENvbnN1bHRpbmcgKFB0eSkgTHRkLjEsMCoGA1UEAxMjVGhhd3RlIFBlcnNv bmFsIEZyZWVtYWlsIElzc3VpbmcgQ0EwHhcNMDQwNzIwMDQzNzI5WhcNMDUwNzIwMDQzNzI5 WjBmMRAwDgYDVQQEEwdTaW5naGppMQ4wDAYDVQQqEwVIYWtpbTEWMBQGA1UEAxMNSGFraW0g U2luZ2hqaTEqMCgGCSqGSIb3DQEJARYbSEFLSU0uU0lOR0hKSUBFQVJUSExJTksuTkVUMIIB IjANBgkqhkiG9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SsGAQQBgjcQBDFrMGkwYjEL MAkGA1UEBhMCWkExJTAjBgNVBAoTHFRoYXd0ZSBDb25zdWx0aW5nIChQdHkpIEx0ZC4xLDAq BgNVBAMTI1RoYXd0ZSBQZXJzb25hbCBGcmVlbWFpbCBJc3N1aW5nIENBAgMMt/owegYLKoZI hvcNAQkQAgsxa6BpMGIxCzAJBgNVBAYTAlpBMSUwIwYDVQQKExxUaGF3dGUgQ29uc3VsdGlu ZyAoUHR5KSBMdGQuMSwwKgYDVQQDEyNUaGF3dGUgUGVyc29uYWwgRnJlZW1haWwgSXNzdWlu ZyBDQQIDDLf6MA0GCSqGSIb3DQEBAQUABIIBADMsyrNBjJT01ouE0TiriB600jskAQXm17ax QLN0VMm2J7HUTwgS23Xqp0OIBEZF7m6ZtcjMFuLLBYw+Y9ymrEiQyhDCLBhZLiTkewBf0r63 T1uyvK6HIDGKYdCPMP/fwZx9FeYoWQP5/O+C3SArOYycP00vAv+agma7VedQrjxTcxoye0r+ c9Xf6aDkrf348rAE83XEhqVnummOUzSTXP3QdZWo5QjP593hTCSUUa0lkf9kexzka580EOVx tGk1DbSkPsgRP6SWs+asgNMbWw9gZux9T7vIHzersWwog088q8zSr0HTU9EnjceunVB/V8GZ bLJ3mO6opqXdrMDFgI4AAAAAAAA= --------------ms090909040905050501070401--
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?4115842C.2090907>