memory full warning message


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting memory full warning message
# 1  
Old 06-11-2008
memory full warning message

Hi I wrote a script
Code:
#!/usr/bin/ksh
#set -x
for fs in `df -k|awk '{print $1}'|sed -n "3,14 p"`
do
    x=`df -kl | grep $fs | awk '{ print $5 }'`
        y=50%

            if [ $x -gt $y ]
                then
                      message="File System `df -k |grep $fs |awk '{print $6\", \"$5}'` Full!!!"
                            echo $subject
                                  echo $message | mailx -s "`hostname` - File System Full Warning !!!"  $RECEIVER
                                      fi
                                      done

here i am not getting the value of x to compare with y because of this the error is coming. how to fix this.

ocuut1@france>./memoryfull_warning
+ ./memoryfull_warning
./memoryfull_warning[8]: test: argument expected
./memoryfull_warning[8]: total: unknown test operator
./memoryfull_warning[8]: test: argument expected
./memoryfull_warning[8]: test: argument expected
./memoryfull_warning[8]: test: argument expected
./memoryfull_warning[8]: total: bad number
./memoryfull_warning[8]: test: argument expected
./memoryfull_warning[8]: test: argument expected
./memoryfull_warning[8]: test: argument expected
./memoryfull_warning[8]: total: unknown test operator
./memoryfull_warning[8]: test: argument expected
./memoryfull_warning[8]: test: argument expected

Last edited by namishtiwari; 06-11-2008 at 10:35 AM..
# 2  
Old 06-11-2008
You commented out your 'set -x'. If you left it, you could have seen what happened. Do that and see if you understand what's happening. BTW, an easier Ksh-safe example of what you're trying to do could be
Code:
thresh=20; df|awk '/\/dev\/[sh]d/ {print $1, $5}'|while read part perc; do
 [ ${perc//\%/} -ge $thresh ] && echo $part $perc over $thresh
done

Also please use "better" thread titles as "memory full warning message" is not what yours is about, it's just scripting errors.
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Unable to get full message text from Windows Event Logs

Hi all, . I am developing a log monitoring solution in perl for Windows I am using the CPAN module Win32 ::EventLog (0.076) version for getting the events from windows. The problem which I am facing now is all the Windows 2008 machines are upgraded with Service pack2 from then I couldn’t able... (2 Replies)
Discussion started by: kar_333
2 Replies

2. AIX

Memory full

I need second opinion: I have a AIX system (5.3) and it is at 100% usage of ram now how to deal with this, without affecting the system, because it's a production system ? here is the information about the system: bash-3.2# svmon size inuse free ... (4 Replies)
Discussion started by: misterx12345
4 Replies

3. Programming

POSIX Message Queue Memory Allocation

Hi, I wanted to know whether the POSIX message queues are statically allocated memory by the kernel based on the parameters specified in the open or as and when we send messages, memory are allocated? Does the kernel reserve the specified memory for the message queue irrespective of whether... (1 Reply)
Discussion started by: sumtata
1 Replies

4. Linux

my box can't see full memory

Hi I'be recently installed Virtouzzo on Centos 5 on 16GB box , but the system could only see 4 GB of RAM, I installed the package kernel-PAE, but the virtuozzo kernel still can't see the full memory. even the kernel system can see 16GB of RAM is there any idea bout that ? Thanks (2 Replies)
Discussion started by: Raied
2 Replies

5. Programming

shared memory and message queues

Hi, According to my understanding.. When message queues are used, when a process post a message in the queue and if another process reads it from the queue then the queue will be empty unlike shared memory where n number of processess can access the shared memory and still the contents remain... (2 Replies)
Discussion started by: rvan
2 Replies

6. AIX

AIX 5.3 errpt full of message: DISK OPERATION ERROR

Hi All, Can anyone explain me the meanning of the following errors: LABEL: SC_DISK_ERR2 IDENTIFIER: B6267342 Description DISK OPERATION ERROR Probable Causes DASD DEVICE Failure Causes DISK DRIVE DISK DRIVE ELECTRONICS Recommended Actions PERFORM PROBLEM DETERMINATION... (1 Reply)
Discussion started by: gianlu
1 Replies

7. Filesystems, Disks and Memory

Memory full (waiting)

Hi When I launch topas I have this result I have a memory problem. I don't know how see the process which waiting. How can I do that? Thanks all!!! (0 Replies)
Discussion started by: Castelior
0 Replies

8. AIX

Printer Memory Message

Hello Everyone, I received the following (root) email. Does anyone know what causes this and how I can find the offending printer? Thanks in advance. Jim Message 2: From daemon Wed Nov 30 09:51:07 2005 Date: Wed, 30 Nov 2005 09:51:07 -0800 From: daemon To: root (2 Replies)
Discussion started by: jlslhills
2 Replies

9. Filesystems, Disks and Memory

Warning Message.

I have had trouble with my PC, due to construction failure I from my dealer or a power-blast over the net I had a broken MotherBoard, CPU and Memory, So I had to get new ones. Now I'm having a 2000Mhz CPU an ASUS P4S... {I think it's P4S500} and new DDR- memory My PC gives a warning-message... (3 Replies)
Discussion started by: Silver
3 Replies
Login or Register to Ask a Question