View Single Post
  #5  
Old 12th March 2006, 22:05
edge edge is offline
Moderator
 
Join Date: Dec 2005
Location: The Netherlands
Posts: 2,044
Thanks: 269
Thanked 154 Times in 133 Posts
Default

Okay.. getting close now..

I found some bash code that might do the trick for me..
Only problem.. I'm getting a syntax error: unexpected end of file (on line 16)

The code will dump the 'ps auxww' output for 'convert' in a file named 'rmp-grep'
Than it will read and 'grep' the file. If $2 is greater than (in this example) 20 it should show BAD Process found

Some one here (falko) who can have a look and let me know why it's giving the 'unexpected end of file' error?

** edit..
When it does find the process and when it's above 20% it will give this error:
./test: line 10: [: 0.0: integer expression expected (I've named the script as 'test' for now)

Thank you

Code:
#!/bin/bash
#
ps auxww | grep "cfmx7" | grep -v grep | cut -c10-14,15-20,61- > tmp-grep
export LINE
(
read LINE
while [ -n "$LINE" ]
do
        set $LINE
        if [ $2 -gt 20 ]; then
                echo "BAD Process found";
                EOF
        fi
        read LINE
done
)< tmp-grep

Last edited by edge; 13th March 2006 at 00:29.
Reply With Quote