Hi ,
i am trying to set up an alert, when CPU usage (0.2%us in below output) is more than 40%
top | head | grep '^Cpu'
Cpu(s): 0.2%us, 0.2%sy, 0.0%ni, 99.1%id, 0.6%wa, 0.0%hi, 0.0%si, 0.0%st
using CUT, i pulled the value 0.2 and assigned to CPU (variable)
CPU=$(expr `top | head -10 | grep "Cpu" | cut -d ' ' -f3 | cut -d '%' -f1`)
if [ ${CPU} -gt 1 ]
then
echo "
Hi guys, I have a script that checks disk usage and emails if it is low but it keeps returning this error:
Use of uninitialized value in concatenation (.) or string at ./df.pl line 17.
tail: cannot open `+2' for reading: No such file or directory
Use of uninitialized value in addition (+) at ./df.pl line 20.
Hello, sorry if I not post at right forum!
I'm writing sh (not bash) script. Want to read dmesg line by line and examine each line content. To date I'm trying with sed command but no success.
Hi, 1st post
Sorry for borrowing the thread.
Hopefully this is doable.
I need to write a script where I need to pick information from my grep-results.
Help request,
I have tsted this line of code for hours. The first line works and the second line returns the message " sed: command garbled.....". This
is running on solaris. The "${} variables all have good values when echoed.
Hi all,
I am trying to write a code for addition of n numbers which will be passed by the user as command line arguments.
I wrote the following code.
Code:
add=0
for (( i = 1 ; i <= $# ; i++ ))
do
add=`expr $i + $add`
done
#echo "sum is : $add"
input :
Code:
$./add.sh 12 32 14 25
Now the problem is the $i is giving values 1,2,3....
Hi,
I am new to shell scripting and unix in general, and I am running into a problem.
I need to grep my script for a line which is a delimiter for an encoded file. I would like to get the line number of this delimiter so that i can use "tail" to get the encoded data and decode it.
Hello All,
I was wondering how to capture the output of an "interactive" command that is run...? I think "interactive" is the
word I'm looking for. For example, commands like "top" and "iftop"...
The One I'm trying to work with is "iftop".
Hello All,
I have an Expect script that ssh's to a remote server and runs some commands before exiting.
One of the commands I run is the "hostname" Command. After I run this command I save the output
using this line in the code below...
Basically it executes the hostname command, then I loop through the "$expect_out(buffer)" variable
line by line.