On 08/11/10 15:35:45, Brett Parker wrote:
(2) This looks *far* more like a job for udev rather than something watching syslog.
So, in /etc/udev/rules.d/99-local.rules (file probably doesn't exist by default, but is the usual name I give to my local rules) add:
== Begin Snippet == KERNEL=="sdb", RUN+="/usr/local/bin/sleep_sdb.sh" == End Snippet ==
Then create a file /usr/local/bin/sleep_sdb.sh containing:
== Begin File == #!/bin/sh
/bin/sleep 10 /sbin/hdparm -Y /dev/sdb == End File ==
Make the file executable (chmod +x /usr/local/bin/sleep_sdb.sh) and bob should be your mother's brother.
Cheers,
Brett Parker http://www.sommitrealweird.co.uk/
I've tried the UDEV suggestion but the strange thing is that when the rule is activated and the script runs I can hear the drive switch off but it then restarts immediately. If I then run that script from a terminal the drive shuts down and doesn't restart.
What I've done in the end is to substitute "/sbin/hdparm -S 60 /dev/sdb" in the UDEV rule and the drive then switches off 5 minutes later which is fine.
I don't understand why it should restart after the hdparm -Y command but at least it's working now.
Many thanks for your suggestion.