LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 05-04-2008, 04:52 AM   #1
BlackRabbit
Member
 
Registered: Oct 2003
Distribution: Debian
Posts: 83

Rep: Reputation: 15
hddtemp logging problem (+ question about sleep mode)


Hi,

I use the following simple script to read out hd-temperatures and write them to a file called hd_temp.log:
Code:
#!/bin/bash
logfile=/root/scripts/hd_temp.log

echo "************************************************************************" >> $logfile
date >> $logfile
echo "*----------------------------------------------------------------------*" >> $logfile
hddtemp /dev/sda >> /root/hd_temp.log
hddtemp /dev/sdb >> $logfile
hddtemp /dev/sdc >> $logfile
hddtemp /dev/sdd >> $logfile
hddtemp /dev/sde >> $logfile
hddtemp /dev/sdf >> $logfile
hddtemp /dev/sdg >> $logfile
hddtemp /dev/sdh >> $logfile
hddtemp /dev/sdi >> $logfile
hddtemp /dev/sdj >> $logfile
hddtemp /dev/hde >> $logfile
hddtemp /dev/hdg >> $logfile
echo "************************************************************************

" >> $logfile
The script is stored under /root/scripts, owned by root and chmodded 755.
When I run this script manually, it writes the wanted information to the given file:
Code:
************************************************************************
Sat May  3 00:54:07 CEST 2008
*----------------------------------------------------------------------*
/dev/sdb: SAMSUNG HD403LJ: 36°C
/dev/sdc: SAMSUNG HD403LJ: 36°C
/dev/sdd: SAMSUNG HD403LJ: 35°C
/dev/sde: SAMSUNG HD403LJ: 32°C
/dev/sdf: Maxtor 6L300S0: 36°C
/dev/sdg: Maxtor 6L300S0: 38°C
/dev/sdh: Maxtor 6L300S0: 38°C
/dev/sdi: HDS722516VLAT20: 31°C
/dev/sdj: SAMSUNG SP1203N: 27°C
/dev/hde: ST3120026A: 36°C
/dev/hdg: ST3120026A: 237°C
************************************************************************
Now, I want this script to run every 10 or so minutes, so I added it to the root cronjobs. This is wat I get:
Code:
************************************************************************
Sun May  4 00:00:01 CEST 2008
*----------------------------------------------------------------------*
************************************************************************


************************************************************************
Sun May  4 00:10:01 CEST 2008
*----------------------------------------------------------------------*
************************************************************************


************************************************************************
Sun May  4 00:20:02 CEST 2008
*----------------------------------------------------------------------*
************************************************************************


************************************************************************
Sun May  4 00:30:01 CEST 2008
*----------------------------------------------------------------------*
************************************************************************


************************************************************************
Sun May  4 00:40:01 CEST 2008
*----------------------------------------------------------------------*
************************************************************************
As one can see, the scripts does run every 10 minutes (so the cronjob is ok & permissions should be too), but the hddtemp output is not written to the file. Any idea how this is? Root cronjobs are run as root, right?

Also, does hddtemp keep harddisks from falling asleep? (I think it doesn't, but I just want to be sure).

Thanks in advance!
 
Old 05-04-2008, 05:09 AM   #2
konsolebox
Senior Member
 
Registered: Oct 2005
Distribution: Gentoo, Slackware, LFS
Posts: 2,248
Blog Entries: 8

Rep: Reputation: 235Reputation: 235Reputation: 235
try to add full path to hddtemp like

/usr/bin/hddtemp /dev/sdb >> $logfile

you can find hddtemp by:

# which hddtemp

Last edited by konsolebox; 05-04-2008 at 05:10 AM.
 
Old 05-04-2008, 05:32 AM   #3
BlackRabbit
Member
 
Registered: Oct 2003
Distribution: Debian
Posts: 83

Original Poster
Rep: Reputation: 15
That did the trick! Thanks!
Could you also explain why this is?



One more question to go:
Quote:
Also, does hddtemp keep harddisks from falling asleep? (I think it doesn't, but I just want to be sure).
 
Old 05-04-2008, 05:59 AM   #4
creativetweak
LQ Newbie
 
Registered: May 2008
Distribution: Debian
Posts: 6

Rep: Reputation: 0
Cron wont be running as root (hopefully!), and therefore will have a different path which dosent include the sbin directories. So although the permissions were right, the shell couldnt locate hddtemp...
 
Old 05-07-2008, 01:13 PM   #5
BlackRabbit
Member
 
Registered: Oct 2003
Distribution: Debian
Posts: 83

Original Poster
Rep: Reputation: 15
Quote:
Originally Posted by BlackRabbit View Post
Also, does hddtemp keep harddisks from falling asleep? (I think it doesn't, but I just want to be sure).

Did some testing myself: forced /dev/sdj to go into stanby mode using hdparm:
Code:
>hdparm -y /dev/sdj
and checked:
Code:
root@SUN:~# hdparm -C /dev/sdj
/dev/sdj:
 drive state is:  standby

Ran hddtemp:
Code:
/usr/sbin/hddtemp /dev/sdj
and checked again:
Code:
root@SUN:~# hdparm -C /dev/sdj
/dev/sdj:
 drive state is:  active/idle

Is there no way to read HDtemps without spinning up the harddisk? (a bit weird, as only SMART is needed to read out temps, no?)
 
  


Reply

Tags
harddisk, hddtemp, temperature



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
disable sleep mode, away mode standby, etc. ZiGz Linux - General 4 06-19-2016 01:15 PM
hddtemp question tgo Linux - Hardware 3 03-21-2006 03:20 PM
Where's sleep mode in RH 8.0? bobterri Linux - Distributions 4 11-26-2002 11:13 PM
Sleep mode mrsolo Linux - Hardware 4 11-26-2002 08:05 PM
sleep mode mr.moto Linux - General 2 12-29-2001 09:43 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

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

Main Menu
Advertisement
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
Open Source Consulting | Domain Registration