1 |
On 22 Aug 2010, at 11:26, Alex Schuster wrote: |
2 |
> Stroller writes: |
3 |
>> |
4 |
>> |
5 |
>> #!/bin/bash |
6 |
>> while true |
7 |
>> do |
8 |
>> for drive in a b c d |
9 |
>> do |
10 |
>> /usr/sbin/smartctl /dev/sd$drive --whatever >> /var/log/hdstate |
11 |
>> done |
12 |
>> sleep 60 |
13 |
>> done |
14 |
> |
15 |
> I use hdparm and hddtemp: |
16 |
> |
17 |
> for hd in sda sdb sdc sdd |
18 |
> do |
19 |
> ... |
20 |
> echo "$hd: $state $temp" |
21 |
> done |
22 |
|
23 |
The script with which you reply is missing the sleep 60 loop. |
24 |
|
25 |
> ... |
26 |
> The problem with cron is that I get those cron logs I do not like, and |
27 |
> that the update time of 60 seconds is a little long. Running the |
28 |
> script in |
29 |
> a loop, started in .kde4/Autostart, would be better, but as a user I |
30 |
> have |
31 |
> no permission to call hdparm or hdtemp. I do not want to be part of |
32 |
> the |
33 |
> disk group, and when using sudo I would get the logs by sudo I |
34 |
> wanted to |
35 |
> avoid. So now I SUID'ed hdparm and hddtemp, changed the group to |
36 |
> wheel and |
37 |
> disabled execution for others. cron problem not solved, but |
38 |
> workarounded. |
39 |
|
40 |
Running a script which contains `while true ... sleep 60` will cause |
41 |
only a single logging action. You can run it as root at startup using / |
42 |
etc/conf.d/local.start and have the file world readable. |
43 |
|
44 |
Stroller. |