On 22 Aug 2010, at 11:26, Alex Schuster wrote:
Stroller writes:


#!/bin/bash
while true
do
  for drive in a b c d
  do
     /usr/sbin/smartctl /dev/sd$drive --whatever >> /var/log/hdstate
  done
sleep 60
done

I use hdparm and hddtemp:

for hd in sda sdb sdc sdd
do
...
        echo "$hd: $state $temp"
done

The script with which you reply is missing the sleep 60 loop.

...
The problem with cron is that I get those cron logs I do not like, and
that the update time of 60 seconds is a little long. Running the script in a loop, started in .kde4/Autostart, would be better, but as a user I have no permission to call hdparm or hdtemp. I do not want to be part of the disk group, and when using sudo I would get the logs by sudo I wanted to avoid. So now I SUID'ed hdparm and hddtemp, changed the group to wheel and disabled execution for others. cron problem not solved, but workarounded.

Running a script which contains `while true ... sleep 60` will cause only a single logging action. You can run it as root at startup using / etc/conf.d/local.start and have the file world readable.

Stroller.


Reply via email to