sd-idle-2.6 is a disk idle spindown program for router firmware based on linux 2.6. Two weeks ago I offered a script for spindown and stated I was working on a C program. This is it.
The advantages of the program are that it handles multiple disks and is more efficient. The time displayed in the transition messages is more accurate and is provided for both up and down transitions (except the very first down transition). It also runs as a daemon automatically. It does NOT require Optware. It simply needs to be stored somewhere and launched. Version and Usage messages go to stdout while all other messages go to syslog.
root@rtn16:/opt/usr/bin# sd-idle-2.6 --help Usage: ( runs as a daemon ) sd-idle-2.6 [ -d devices ] [ -i idletime ] [ -c checktime ] [ -h --help ] [ -v --version ] -d [a-z]+ include where a => /dev/sda, b => /dev/sdb (default is all disks) ![a-z]+ exclude -i n n seconds a disk must be idle to spin it down (default 900, min 300) -c n n seconds to sleep between idle checks (default 30, min 5) -h --help usage -v --version version for example: sd-idle-2.6 will manage all disks with default times sd-idle-2.6 -d bc will manage /dev/sdb, /dev/sdc with default times sd-idle-2.6 -d !bc will manage all disks except /dev/sdb, /dev/sdc with default times sd-idle-2.6 -i 600 will manage all disks spinning down after 600 seconds or 10 minutes
If all disks are being managed (the default) then a new disk added to the router on the fly will automatically be managed.
There is of course no need to manage flash drives for idleness. Nonetheless, the spindown command gave no error when I tried it with my flash drive. Others experience may differ. But there may be no need to exclude them and, if managed, will generate transition messages for them.
sd-idle.2.6.tar.gz contains both the executable file sd-idle-2.6 and the single source file sd-idle-2.6.c.
See how to autorun for the obvious.
Feedback is welcome.