On Mon, Jun 14, 2004 at 12:37:22AM +0000, Stefan A. Deutscher wrote:
> Hi, I have a 5.1Release machine with currently four SCSI disks, out of
> which I need only two at any given time (system and /home). The other
> ones are an alternative system disk, and an OS/2 disk.

[ snip ]

> To reduce noise and heat production, I am going to spin down two SCSI
> disks on one of my machines with 
>   camcontrol stop -n da -u 0
>   camcontrol stop -n da -u 2

[ snip ]

> To spin down the disks right after boot, I ponder sticking things
> either in the /etc/rc.local (seems to be going out of style though) or
> as a separate script in /etc/rc.d/.  Any thoughts on that would be
> appreciated. As these commands take a while to return with a success
> message I'd like to do that in the background, and I wish to log it
> somewhere. Is there 'the right' way to send the camcontrol messages to
> syslog or the dmesg file (all true believers shall open their egg at
> the right end!)?

Following up to myself, I cooked the following script to be placed in
/etc/rc.d/, it works fine and does what I want it to do. Maybe it helps
someone else to save time to accomplish the same thing.
Now I just wonder whether it would be more elegant to place a script
that does the actual work in /usr/local/bin and just launch that one
from a small script in /etc/rc.d/. I suppose it's a matter of taste.
Oh - does stuff like this merit submission to ports?

[ --- cut here --- ]
# Script to spin down unneeded SCSI disks right after system start
# and log this in the system log (which should be up by then) using
# /usr/bin/logger (the partition holding it should be mounted by then):

# PROVIDE: spindown_disks
# REQUIRE: mountall mountd syslogd

LOGGER="/usr/bin/logger -s -t camcontrol"

PROGNAME=`basename $0`

case "$1" in 

     ${LOGGER} Spinning down SCSI disks not needed ...
     ( /sbin/camcontrol stop -n da -u 0 > /dev/null && \
        ${LOGGER} da0 stopped successfully. ) \
     || ${LOGGER} da0 could not be stopped

     ( /sbin/camcontrol stop -n da -u 2 > /dev/null && \
        ${LOGGER} da2 stopped successfully. ) \
     || ${LOGGER} da2 could not be stopped

     echo "${PROGNAME}: unknown option '$1' - should be 'start', 'faststart' or 
'stop'" >&2

# eof.
[ --- cut here --- ]

Cheers, Stefan

[EMAIL PROTECTED] mailing list
To unsubscribe, send any mail to "[EMAIL PROTECTED]"

Reply via email to