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!