Idler is a spindown daemon for external drives. For internal drives you can generally use hdparm to set a spindown time, but it does not work for USB/Firewire drives. For those you need a daemon that periodically monitors disk activity, and sends a SCSI stop command after a period of idleness.
This release is written for a Gentoo system, but it is probably easily adapted to other distributions. The script requires a SCSI utility package called sys-apps/sg3_utils in Gentoo. Minimal installation instructions are included in the README file.
Current release: idler-20090315
Alternatively, you can use the ebuild sys-apps/idler-20090315.ebuild.
You can add any number of drives to /etc/idler.conf. You can use a general timeout for all drives, and/or individual timeouts for each drive. For external drives, the use of IDs instead of traditional device names is encouraged. The drives do not have to exist at the moment; you can keep the daemon running so that it is ready when you plug in sdc, for example. However, since there is a wait loop running for each configured drive, keep the number of drives sensible.
After changing the configuration, do not forget to restart the daemon: /etc/init.d/idler restart
The idea and some implementation details are adapted from Rusi's SCSI standby daemon that I've used for a long time with great success. I needed to deal with multiple drives, so I wrote a threaded version in Python.
There seems to be another package for the same task called Spindown. It appears somewhat more capable than Idler. I personally find the option of using hardware id (as opposed to device name like sda) very useful, so I've added it to Idler as well :-j
Actually, for practical purposes, I recommend Spindown. It has much more real-world testing under its belt. I only wrote Idler as a personal learning experience, at a time when I did not know of Spindown.
However, from a programming standpoint I do have a few ideological reasons why I continue to develop Idler even as I know Spindown:
Also, I do not see a reason to add hdparm as an alternative to sg_start. For those drives that work with hdparm, you can use hdparm -S to set a timeout, and a daemon like this is not needed. Of course, there can be some exceptions that I am not aware of. Besides, even sg_start does not work with some USB drive adapters.