Olaf Marzocchi wrote:

I noticed hdparm is able to change the acoustic management value of HD (-Y flag) and my HD (IBM 60GXP 40 GB) is able to report it's temperature (I use hddtemp), so I decided it could be neat to have a script to set the HDspeed automatically, for example every 15 minutes.

Unfortunately, I have never wrote scripts that deal with strings and I'm not able to extract the value of temperature and system load.
hddtemp report this: "/dev/hda: IC350L40AVER07-0: 42�C"
and /proc/loadavg: 0.005 0.02 0.01 xxxxxx".


I'd like to extract the temperature ("42") and the third value of system load (if I remember correctly, the first refers to the first minute, the second to 5 minutes and the third 15 minutes).

I tried sed and gawk but without success.

This is what "awk" was made to do. You can use it. Because I have no idea of what your script looks like, I can only quess that you want to filter some command, like "grep" possibly, by piping it through "awk". Just make sure you get the print varible right, for example, something like "ps -elf | grep "some_value" | awk '{ print $2 }' (This is only an example, and, in case you are wondering, it would only return the pid for "some_value" daemon that would be running.) Play with the $PRINT varible until you see the results that you want..........


drjung

--
J. Craig Woods
UNIX Network/System Engineer
http://www.trismegistus.net/resume.htm
Let him that would move the world, first move himself.
--Socrates



Want to buy your Pack or Services from MandrakeSoft? 
Go to http://www.mandrakestore.com

Reply via email to