NSLU2-Linux - FAQ / SpinDownUSBHarddisks browse
"Shell-only scsi-idle without kernel patch"の部分がよさげです。
#!/bin/sh
disk=$1
interval=$2
state=`grep " $disk " /proc/diskstats`
count=$interval
up=1
while [ true ]; do
sleep 10
count=$(($count-10))
newstate=`grep " $disk " /proc/diskstats`
if [ "$state" = "$newstate" ]; then
if [ $count -lt 0 ]; then
count=$interval
if [ $up = 1 ]; then
#echo -e "spin-down\\t" `date`
sync
state=`grep " $disk " /proc/diskstats`
scsi-stop /dev/$disk
up=0
fi
fi
else
#echo -e "drive is up\\t" `date`
count=$interval
state="$newstate"
up=1
fi
done











コメントする