1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 | #!/bin/bash
logger drivelog: starting
while [ true ]
do
for DRIVE in sda sdb sdc sdd
do
if ( hdparm -C /dev/$DRIVE | grep -q standby )
then
if [ ! -f /tmp/drivelog_$DRIVE ]
then
logger drivelog: $DRIVE spin down
touch /tmp/drivelog_$DRIVE
fi
else
if [ -f /tmp/drivelog_$DRIVE ]
then
logger drivelog: $DRIVE spin up
rm /tmp/drivelog_$DRIVE
fi
fi
done
sleep 60
done
|