Milhouse
Guru
- Joined
- Jun 1, 2011
- Messages
- 564
Big thank you to Milhouse for your Script!
I have a Intel SASUC8i controller with 7 discs attached and the script works fine for me. Is there a solution for autostart of this script yet?
Yes, I've been running an updated version that can be installed as a service and started at boot (or stopped/started manually). There are two files you need to create, and a config change, all three files are attached to this post in a single archive.
Follow the steps below and you should be good to go... an installable package would be nice, but I don't know how to make one. :)
- Obtain read-write access to your root partition
Code:mount -uw /
- Create the following service control script as /conf/base/etc/local/rc.d/sasidled (or copy from the attached archive)
Code:#!/bin/sh # PROVIDE: sasidled # REQUIRE: FILESYSTEMS DAEMON # BEFORE: LOGIN # KEYWORD: shutdown #sasidled_enable=YES sasidled_prefix="/usr/local" . /etc/rc.subr name="sasidled" command_interpreter="/bin/sh" rcvar=`set_rcvar` load_rc_config $name command="${sasidled_cmdpath-/usr/local/bin}/sasidle" command_args="${sasidled_args}" required_dirs="/var/run" pidfile="/var/run/$name.pid" start_precmd="sasidled_prestart" stop_postcmd="sasidled_poststop" sasidled_prestart() { if [ ! -d /var/run ]; then mkdir -p /var/run fi } sasidled_poststop() { rm -f $pidfile } run_rc_command "$1"
- Install the service wherever you want, on my system I create it as /mnt/share/bin/sasidle (or copy from the attached archive)
EDIT: See post #79 for the latest version of the script.
- Set the correct permissions on the service and control files:
Code:chmod 555 /conf/base/etc/local/rc.d/sasidled chmod 755 /mnt/share/bin/sasidle
- Configure the service by adding the following entries to the end of /conf/base/etc/rc.conf (or copy from the attached archive)
Code:sasidled_enable=YES sasidled_cmdpath=/mnt/share/bin sasidled_args="-v"
Note that sasidled_cmdpath points to the directory containing sasidle - in my case this is /mnt/share/bin.
You can specify the sasidle command line arguments in sasidled_args. The "-v" option will log output every 1 minute to /var/log/messages, eventually you will want to change this to just "". You can also specify in sasidled_args which disks to monitor if this isn't detected automatically, and which zPool to monitor (currently the script can only handle a single zPool). Default timeout and intervals are 30 and 60, which should spindown all disks visible to camcontrol after 30 minutes (30 x 60 seconds) of idle.
- Remount root partition as read-only and reboot:
Code:mount -ur / reboot
You should see notification that sasidled has started towards the end of the boot sequence.
You can monitor sasidled by executing "/etc/local/rc.d/sasidled status", or start and stop it by specifying the appropriate parameter.
Log output is written to /var/log/messages.
Any problems let me know and I'll try to fix them! :)