Here is a Ruby script that uses sg3_utils to automatically put a SCSI device into standby mode after a configurable idle time period. This also works with USB storage devices (tested with Linux Kernel 2.6.14, sg3_utils 1.11 on Gentoo Linux with an NEC PCI USB 2.0 controller and an external Samsung SP2514N hard disk in an ICY Box).
You can download version 0.1 here.
Please adapt it to your needs and simply add it to your init scripts so it will be started automatically when your computer boots.
Here’s an example for that on Gentoo Linux:
#!/sbin/runscript
start() {
ebegin "Starting Rusi's SCSI standby daemon"
start-stop-daemon --start -v --background --pidfile /var/run/rusi_sg_downd.pid --make-pidfile --exec /usr/local/sbin/rusi_sg_down
eend $?
}
stop() {
ebegin "Stopping Rusi's SCSI standby daemon"
start-stop-daemon --stop -v --pidfile /var/run/rusi_sg_downd.pid
eend $?
}
Hi, the name's Steffen and I'm writing about the Web, programming
and all those things coming to my mind. Enjoy your stay.
January 31st, 2006 at 0:04
Thanks very much for this, works a treat.
Leave a Reply