Alex,
Just sent you the e-mail.
Regards,
Jromariz.
Shell Script Problem
File contains non-printable characters because "top -n 1" uses escape secuences.
Also do not use ":%" because "99:%" is not correct reply, it should be "99 %" (space, not colon).
Recommendations:
1) use "-b" option for top command
2) use " %" as suffix, not ":%"
2) do not use CPU variable in the script
E.g. this script works fine on our Linux system
Regards
Alex
Also do not use ":%" because "99:%" is not correct reply, it should be "99 %" (space, not colon).
Recommendations:
1) use "-b" option for top command
2) use " %" as suffix, not ":%"
2) do not use CPU variable in the script
E.g. this script works fine on our Linux system
Code: Select all
#!/bin/sh
top -b -n 1 | grep "Cpu(s)" | awk -F" " '{ printf("%s\n",$8) }' | awk -F"%" '{ printf("scriptres:Ok:%d\n",100-$1) }'
Alex
Alex,
The script is working but I notice a strange behavior. The values of CPU usage that are logged are different from the ones the script is returning, at least the ones returned by "Let´s try" option of Script Manager. I´ve compared the values from the "Let´s try" to the one´s of top on the machine and looks correct, but the ones been logges are a lot different.
Any idea?
Jromariz.
The script is working but I notice a strange behavior. The values of CPU usage that are logged are different from the ones the script is returning, at least the ones returned by "Let´s try" option of Script Manager. I´ve compared the values from the "Let´s try" to the one´s of top on the machine and looks correct, but the ones been logges are a lot different.
Any idea?
Jromariz.