On Thu, 04 Sep 2003 19:05:48 +0200
Olaf Marzocchi <[EMAIL PROTECTED]> 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.
> 
> THX
> Olaf 
> 
> 
> 

to extract temperature:
i don't know about hddtemp output, so i use var="/dev/hda: IC350L40AVER07-0: 42�C" for 
this example ->
$ set -- $var; echo ${!#//[^0-9]/}

to extract the 3rd field from /proc/loadavg
$ set -- $(</proc/loadavg); echo $3


bye
jipe

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

Reply via email to