LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware
User Name
Password
Slackware This Forum is for the discussion of Slackware Linux.

Notices

Reply
 
Search this Thread
Old 10-28-2009, 02:08 AM   #1
orbit
Member
 
Registered: Sep 2006
Location: Australia
Distribution: Slackware
Posts: 176

Rep: Reputation: 30
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:

Code:
#!/bin/sh
## 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:

Quote:
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:

Code:
#!/bin/sh
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:

Quote:
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.

Cheers
 
Old 10-28-2009, 03:26 AM   #2
~sHyLoCk~
Senior Member
 
Registered: Jul 2008
Location: /dev/null
Posts: 1,173
Blog Entries: 12

Rep: Reputation: 129Reputation: 129
Will this work?
Quote:
echo "ISOs : " $(/usr/sbin/hddtemp /dev/hda)
And accordingly for each hdd...

Last edited by ~sHyLoCk~; 10-28-2009 at 03:27 AM.
 
Old 10-28-2009, 05:26 PM   #3
orbit
Member
 
Registered: Sep 2006
Location: Australia
Distribution: Slackware
Posts: 176

Original Poster
Rep: Reputation: 30
Hi ~sHyLoCk~

This is what I used:

Code:
#!/bin/sh
## 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:

Quote:
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

Cheers

Last edited by orbit; 10-28-2009 at 05:30 PM.
 
Old 10-29-2009, 01:09 AM   #4
~sHyLoCk~
Senior Member
 
Registered: Jul 2008
Location: /dev/null
Posts: 1,173
Blog Entries: 12

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

Code:
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:

Quote:
ISOs: [hda] : 1°C

Last edited by ~sHyLoCk~; 10-29-2009 at 01:11 AM.
 
Old 10-29-2009, 12:35 PM   #5
Woodsman
Senior Member
 
Registered: Oct 2005
Distribution: Slackware 14.1
Posts: 3,482

Rep: Reputation: 534Reputation: 534Reputation: 534Reputation: 534Reputation: 534Reputation: 534
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.
 
Old 10-29-2009, 02:17 PM   #6
onebuck
Moderator
 
Registered: Jan 2005
Location: Midwest USA, Central Illinois
Distribution: SlackwareŽ
Posts: 11,134
Blog Entries: 3

Rep: Reputation: 1405Reputation: 1405Reputation: 1405Reputation: 1405Reputation: 1405Reputation: 1405Reputation: 1405Reputation: 1405Reputation: 1405Reputation: 1405
Hi,

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
LinuxSelfHelp
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!
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Need assistance with shell script to pull MP3 file Cpare Linux - Newbie 5 06-28-2008 08:53 PM
Perl script assistance; paste word into external command bru Programming 3 02-21-2007 07:46 AM
need assistance with this script rsmccain Linux - General 2 02-08-2007 10:41 PM
Shell script assistance required.. TheEngineer Linux - Newbie 4 10-26-2006 06:42 AM
Assistance with 'find -exec cp' shell script dick.swift Linux - Software 6 01-23-2006 10:00 AM


All times are GMT -5. The time now is 08:15 AM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration