Re: Help Debugging Kshell Script???

2004-08-08 Thread David Fleck
Unfortunately, I think the script you attached has been mangled in some 
way or other; it appears to be missing the end of the 'paging_mon' 
function, as well as whatever code invokes that function (and the swap_mon 
function as well).  If I try to run it, I get:

dcf$ ./swap_mon.ksh
\nSwap Space Report for grond.sourballs.org\n
Sun Aug  8 07:31:26 CDT 2004
./swap_mon.ksh: line 85: funtion: command not found
./swap_mon.ksh: line 135: syntax error: unexpected end of file
if I fix the typo (funtion - function) I just get the 'unexpected EOF' 
error.

Both my 4.9 and 5.2.1 systems have /usr/bin/bc, so I assume it is part 
of the base install.  However, neither system has 'lsps', which appears 
to be an AIX command.

--
David Fleck
[EMAIL PROTECTED]
___
[EMAIL PROTECTED] mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to [EMAIL PROTECTED]


Re: Help Debugging Kshell Script???

2004-08-08 Thread Hakim Z. Singhji
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1
David,
I appologize you are correct the script I sent you is a version of the
same script that I am working on for an AIX machine.  Attached is an
unencrypted version of the script for System V: BSD/Linux machines.
This is the error it is giving me and I'm not sure why I am getting this
error?

[EMAIL PROTECTED] sys_admin]$ ./swap_mon.ksh~
\nSwap Space Report for redgate.ath.cx\n
Sun Aug  8 00:03:48 EDT 2004
(standard_in) 3: illegal character: O
(standard_in) 3: parse error
(standard_in) 3: illegal character: O
(standard_in) 3: parse error
\nTotal Amount of Swap Space:\t494MB
Total KB of Swap Space Used:\t23MB
Total KB of Swap Space Free:\t471MB
\nPercent of Swap Space Used:\t4.6500%
\nPercent of Swap Space Free:\t95.3400%
\n
#
I need some help figuring out why bc is giving me such a hard time. I'm
almost positive my syntax is correct. This is where I think the problem
begins (and possibly ends) in the script:
#
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
)
##
Thanks for your help in advance.
HZS
David Fleck wrote:
| Unfortunately, I think the script you attached has been mangled in some
| way or other; it appears to be missing the end of the 'paging_mon'
| function, as well as whatever code invokes that function (and the
| swap_mon function as well).  If I try to run it, I get:
|
| dcf$ ./swap_mon.ksh
| \nSwap Space Report for grond.sourballs.org\n
| Sun Aug  8 07:31:26 CDT 2004
| ./swap_mon.ksh: line 85: funtion: command not found
| ./swap_mon.ksh: line 135: syntax error: unexpected end of file
|
| if I fix the typo (funtion - function) I just get the 'unexpected EOF'
| error.
|
| Both my 4.9 and 5.2.1 systems have /usr/bin/bc, so I assume it is part
| of the base install.  However, neither system has 'lsps', which appears
| to be an AIX command.
|
|
| --
| David Fleck
| [EMAIL PROTECTED]
|
| ___
| [EMAIL PROTECTED] mailing list
| http://lists.freebsd.org/mailman/listinfo/freebsd-questions
| To unsubscribe, send any mail to
| [EMAIL PROTECTED]
|
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.2.4 (GNU/Linux)
iD8DBQFBFkiclT9WV6TztkoRAngzAJ4jtRcnE5ZkANyZOM9ORxb+scnMNACeJFVf
JzNrpFMIjSw0NfpxOgyT13U=
=sXLe
-END PGP SIGNATURE-
##
#! /usr/bin/ksh   
###
#  CREATED_BY: Hakim Z. Singhji
###
#  SCRIPT:  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 
#space statistics including: Total paging space in MB, MB of free 
#paging space, MB of used pagine space, % of 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 

free -m | grep -i swap | while read junk 

Re: Help Debugging Kshell Script???

2004-08-08 Thread David Fleck
On Sun, 8 Aug 2004, Hakim Z. Singhji wrote:
I appologize you are correct the script I sent you is a version of the
same script that I am working on for an AIX machine.  Attached is an
unencrypted version of the script for System V: BSD/Linux machines.
Now I get this error:
Swap Space Report for grond.sourballs.org
Sun Aug  8 13:25:18 CDT 2004
new.ksh[79]: free: not found
and indeed, I can't find a 'free' command on 4.9, 5.2.1, or in ports - 
just the 'free' (3) system call.  What are you using here?

--
David Fleck
[EMAIL PROTECTED]
___
[EMAIL PROTECTED] mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to [EMAIL PROTECTED]


Re: Help Debugging Kshell Script???

2004-08-08 Thread horio shoichi
On Sun, 08 Aug 2004 11:37:01 -0400
Hakim Z. Singhji [EMAIL PROTECTED] wrote:

 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
 )
 ##

Which ksh are you running (/usr/local/bin/ksh{,93)) ?

If you are really new to this sort of things, test them interactively
with 'set -ux' options.


horio shoichi

BTW., it gave me a thing like this on 4.9-STABLE with /usr/local/bin/ksh.


% ksh
$ SW_USED=1
$ SW_TOTAL=3
$ PERCENT_USED=$(bc EOF
 scale=4
 ($SW_USED / $SW_TOTAL) * 100
 EOF
 )
$ echo $PERCENT_USED
33.3300
$ ^D
%

___
[EMAIL PROTECTED] mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to [EMAIL PROTECTED]


Re: Help Debugging Kshell Script???

2004-08-07 Thread Hakim Z. Singhji
-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 

Help Debugging KShell Script???

2004-08-06 Thread Hakim Z. Singhji
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1
Hello Everyone,
I need some help with this shell script.  I originally wrote it in ksh
and I not really familiar with bash.  However, that is what I'm using at
home now and I don't have ksh on any of my machines... Could you folks
help me convert this script to bash...I don't think the arithmatic
operator bc is a bash option.  It appears that is where the first bug
is at.
Please see the attached (encrypted/compressed) script for any additional
details.  You must import my public key to open the attached file.
**
gpg --decrypt swap_mon.ksh.sig
**
Thanks in advance
HZS
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.2.4 (GNU/Linux)
iD8DBQFBEwwglT9WV6TztkoRAnGcAJ4tVU6pQLp6ZQIBGWcjkTrVsEI6mACfWG9Y
AIjZC7q4Doa6440/Gk1YgPI=
=Yvuq
-END PGP SIGNATURE-
-BEGIN PGP MESSAGE-
Version: GnuPG v1.2.4 (GNU/Linux)

owG9V89v21Qc71ohFAsQEweu3zap1qI1SVEYYLUaTvKyGJI4sp0WRlBx7JfYa/Ic
2c9bC9sdMSFxAYkTB7hw4MqZw06TuHDjH0AcEBfEbpP4PjtO01ZNQWr3pGm1/f31
+Xy/7/NevnxxaWHx6lc3d3a///und6/8+NKvvRfCe9Z4b+Sz/H7oKq9IS9kLXVJ2
GQpRGBR6HitghkyyIF7SxebCZAAVnSgmqe6VP5Chbu17I7idB8NjA/eOdxn5jIqu
tk0ZY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WksceXh3Qu1Xq0Rb
TpewTjvTZbuK3lJbt2RoJ6OZ9EYURo4KS6QZOzVB+2B1ousNAWNZSFtaQjBbQq12
Rg1pIX0PlQLPj6mIrly8OpZJQ9sFgySKTnRd06GJKqjcIlDt4FsNjDppNKCitSZ3
TSGUeFY2DXFX+NAV9/h3AuoMhD4lN4LwoxzkC7M/XtDyrDNg4pq3uJu3D7oMTWuB
BwpeNeAGFItysSRvloBUTXi9WCzh5+OhZRwXvFttyqij8vSugSOA0SMck/9vf47U
lN4uNctoNl9bivNsJrs7jXSOeqzOMZlESkye8eFJ8NDUalBTG3OvTDPxPru59NyC
+CGb/sy9uvj8o4VvD159+N0Pj//84umbnd8f/vP4/Zf7n9OFb664T+9+/Ndvf3S3
vn5UX/z5ycrSL9f+BQ==
=3pCO
-END PGP MESSAGE-
___
[EMAIL PROTECTED] mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to [EMAIL PROTECTED]


Help Debugging Kshell Script???

2004-08-06 Thread Hakim Z. Singhji
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1
Hello Everyone,
I need some help with this shell script.  I originally wrote it in ksh
and I not really familiar with bash.  However, that is what I'm using at
home now and I don't have ksh on any of my machines... Could you folks
help me convert this script to bash...I don't think the arithmatic
operator bc is a bash option.  It appears that is where the first bug
is at.
Please see the attached (encrypted/compressed) script for any additional
details.  You must import my public key to open the attached file.
**
gpg --decrypt swap_mon.ksh.sig
**
Thanks in advance
HZS
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.2.4 (GNU/Linux)
iD8DBQFBExinlT9WV6TztkoRAqHMAKCMFthVnjHWNh6aoNZdSBfoOeveLACeLURE
n7WTKf5/nFy4e5vdrMN5Pc8=
=732m
-END PGP SIGNATURE-
-BEGIN PGP MESSAGE-
Version: GnuPG v1.2.4 (GNU/Linux)

owG9V89v21Qc71ohFAsQEweu3zap1qI1SVEYYLUaTvKyGJI4sp0WRlBx7JfYa/Ic
2c9bC9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mm3Ag9XzHafZZgkX
jjGDtwKrF1PmMU4HKCGCK6EIKZOTmOnZyAXLuOEkOLGysbl/d6pC3MWOuP7QEYlU
zHticuKqc7MvcfJRwmHDycNGf3PSZK8Pa2uQCh9sbcPJWLAuTDE7myjbjPglpbhW
iOeDTakjQLhHpV3H44Y5p7AcYZoVSYEjw8dYYTgKffyI+70FWksceXh3Qu1Xq0Rb
TpewTjvTZbuK3lJbt2RoJ6OZ9EYURo4KS6QZOzVB+2B1ousNAWNZSFtaQjBbQq12
Rg1pIX0PlQLPj6mIrly8OpZJQ9sFgySKTnRd06GJKqjcIlDt4FsNjDppNKCitSZ3
TSGUeFY2DXFX+NAV9/h3AuoMhD4lN4LwoxzkC7M/XtDyrDNg4pq3uJu3D7oMTWuB
BwpeNeAGFItysSRvloBUTXi9WCzh5+OhZRwXvFttyqij8vSugSOA0SMck/9vf47U
lN4uNctoNl9bivNsJrs7jXSOeqzOMZlESkye8eFJ8NDUalBTG3OvTDPxPru59NyC
+CGb/sy9uvj8o4VvD159+N0Pj//84umbnd8f/vP4/Zf7n9OFb664T+9+/Ndvf3S3
vn5UX/z5ycrSL9f+BQ==
=3pCO
-END PGP MESSAGE-


smime.p7s
Description: S/MIME Cryptographic Signature


Re: Help Debugging Kshell Script???

2004-08-06 Thread David Fleck
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]
___
[EMAIL PROTECTED] mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to [EMAIL PROTECTED]