Loading ...
Sorry, an error occurred while loading the content.
 

Re: spin down disks on debianslug

Expand Messages
  • spikes_nslu2
    ... i have edited this slightly to use Sg_start and am also calling this using crontab, seems to be working ok at the moment, and will report any problems.
    Message 1 of 11 , Jan 2, 2007
      --- In nslu2-linux@yahoogroups.com, "BxWen" <bxwen@...> wrote:
      >
      > --- In nslu2-linux@yahoogroups.com, "spikes_nslu2" <peter.spikes@>
      > wrote:
      > >
      > > hi all, I have managed to install the sg3-utils so i can use the
      > > sg_start to stop my drives.
      > >
      > > but i can't figure out a script to auto spin-down drives after x
      > > amount of time, like scsi-idle does on unslung etc.
      > >
      > > anyone willing or able to help?
      > >
      > > many thanks.
      > >
      > > Peter.
      > >
      > Here's what I do to my gentoo nslu2:
      > 1. root on a 1GB flash drive, a westerndigital 120G mounted at /external
      > 2. vixie-cron runs the script every 15 minutes
      > 3. the script checks the mount point /external with fuser. If it is
      > not used, power it down.
      >
      > #!/bin/sh
      > #
      > # Script to see whether argument is positive or negative
      > #
      > echo "***************`date`********" >> /var/log/power
      > t=`fuser -c /external`
      > if test "$t"
      > then
      > echo "in use" >> /var/log/power
      > else
      > echo "not in use, power down." >> /var/log/power
      > echo "`sdparm -C stop /dev/sdb`" >> /var/log/power
      > fi
      > echo $t >> /var/log/power
      > echo "" >> /var/log/power
      >


      i have edited this slightly to use Sg_start and am also calling this
      using crontab, seems to be working ok at the moment, and will report
      any problems.

      will add it to the wiki later this evening.

      #!/bin/sh
      #
      # Script to see if external storage is being used
      # if its not being used, place drive in idle
      #
      # to change to your own config, change /hd to your mount point
      #

      echo "***************`date`********" >> /var/log/power
      t=`fuser -c /hd`
      if test "$t"
      then
      echo "in use" >> /var/log/power
      else
      echo "not in use, power down." >> /var/log/power
      echo "`sg_start --stop /dev/sdb`" >> /var/log/power
      fi
      echo $t >> /var/log/power
      echo "" >> /var/log/power


      many thanks

      Peter
    • Marcus Better
      ... No, it s too unfinished to put on the wiki, but you can download it here as a tarball or Debian package: http://www.better.se/debian/spindown-idle/ Run it
      Message 2 of 11 , Jan 3, 2007
        CN wrote:
        >> I also wrote my own version in C which I intend to clean up and publish,

        > I am interested. Please post it on a new Wiki page,

        No, it's too unfinished to put on the wiki, but you can download it here as
        a tarball or Debian package:

        http://www.better.se/debian/spindown-idle/

        Run it like this:

        # spindown-idle /dev/sda 600

        to spin down after 600 seconds inactivity. (Drives other than /dev/sda are
        not supported yet!)

        Marcus
      Your message has been successfully submitted and would be delivered to recipients shortly.