-   Slackware (
-   -   HDDTemp : Script Assistance (

orbit 10-28-2009 02:08 AM

HDDTemp : Script Assistance
Hi all,

I have built a very basic script to show me my HDD temperatures, and was wondering if it would be possible to have the HDD label displayed with the relevant device?

This is what I have at the moment:


## This script has been created to enable quick HDD Temperature Monitoring.
## Usage: hddtmp

/usr/sbin/hddtemp /dev/hda
/usr/sbin/hddtemp /dev/hdb
/usr/sbin/hddtemp /dev/hdc
/usr/sbin/hddtemp /dev/sda
/usr/sbin/hddtemp /dev/sdb

And this is what it displays:


root@Black:/# hddtmp
/dev/hda: ST3200820A: 43°C
/dev/hdb: Maxtor 6Y120L0: 34°C
/dev/hdc: ST3200820A: 47°C
/dev/sda: SAMSUNG HD080HJ: 36°C
/dev/sdb: ST3160815AS: 46°C

What I would like to do now is to add a label to each corresponding drive, so that it is easier to remember what each temp refers to ...

This following code doesn't work, this is only an example of what I am trying to do; but maybe someone could give me some pointers please:


echo ISOs | /usr/sbin/hddtemp /dev/hda | alias ISOs
echo Movies | /usr/sbin/hddtemp /dev/hdb | alias Movies
echo Storage | /usr/sbin/hddtemp /dev/hdc | alias Storage
echo Linux | /usr/sbin/hddtemp /dev/sda | alias Linux
echo Other | /usr/sbin/hddtemp /dev/sdb | alias Other

What I am aiming at as a final product would be something displayed like this:


ISOs : 43°C : (hda)
Movies : 34°C : (hdb)
Storage : 47°C : (hdc)
Linux : 36°C : (sda)
Other : 46°C : (sdb)

Thanks very much in advance for any assistance.


~sHyLoCk~ 10-28-2009 03:26 AM

Will this work?

echo "ISOs : " $(/usr/sbin/hddtemp /dev/hda)
And accordingly for each hdd...

orbit 10-28-2009 05:26 PM

Hi ~sHyLoCk~

This is what I used:


## This script has been created to enable quick HDD Temperature Monitoring.
## To enable running as user, add sudo support to /etc/sudoers (see example file).
## Usage: hddtmp

echo "ISOs    : "$(/usr/sbin/hddtemp /dev/hda)
echo "Movies  : "$(/usr/sbin/hddtemp /dev/hdb)
echo "Storage : "$(/usr/sbin/hddtemp /dev/hdc)
echo "Linux  : "$(/usr/sbin/hddtemp /dev/sda)
echo "Other  : "$(/usr/sbin/hddtemp /dev/sdb)

And this is what it outputs:


root@Black:/usr/local/bin# hddtmp
ISOs : /dev/hda: ST3200820A: 44°C
Movies : /dev/hdb: Maxtor 6Y120L0: 39°C
Storage : /dev/hdc: ST3200820A: 42°C
Linux : /dev/sda: SAMSUNG HD080HJ: 40°C
Other : /dev/sdb: ST3160815AS: 42°C

Now after adding sudoer support, I have just set it up with a keyboard terminal hotkey shortcut in KDE, so as a user I can see at a glance what is happening with the HDD temps.

This is great, Thank you very much for your assistance :)


~sHyLoCk~ 10-29-2009 01:09 AM

Well i wrote that in a hurry, to shorten it you can use this instead:


echo ISOs: [hda] : $(sudo /usr/sbin/hddtemp /dev/hda | grep /dev | cut -d":" -f3)
You might need to chnge the field -f3 accordingly. Experiment with it. For me it is showing:


ISOs: [hda] : 1°C

Woodsman 10-29-2009 12:35 PM

Oribit, just an additional thought. I use a shell alias to display the temps of my HDs when using the command line, but I don't need the additional information like you. I use Conky to display the temps on my X desktop.

onebuck 10-29-2009 02:17 PM


Orbit, just a few links to aid you in the future. The ABS is great;

SlackwareŽ Essentials
SlackwareŽ Basics
Linux Documentation Project
Rute Tutorial & Exposition
Linux Command Guide
Utimate Linux Newbie Guide
Getting Started with Linux
Advanced Bash-Scripting Guide
Virtualiation- Top 10


These links and others can be found at 'Slackware-Links'. More than just SlackwareŽ links!

All times are GMT -5. The time now is 02:50 PM.