FreeNAS Code
This project has moved to github - see https://github.com/freenas
Brought to you by:
cochard,
mattolander
#!/bin/sh # Copyright (c) 2007 Volker Theile (votdev@gmx.de) # All rights reserved. # PROVIDE: ataidle # REQUIRE: DAEMON # BEFORE: LOGIN . /etc/rc.subr . /etc/configxml.subr echo -n "Initializing idle timer/UDMA on ATA disks: " # Process all configured IDE disks. /usr/local/bin/xml sel -t -m "//disks/disk[type = 'IDE']" \ -v "concat(name,' ',udma,' ',harddiskstandby,' ',apm,' ',acoustic)" \ -i "position() != last()" -n -b \ ${configxml_file} | /usr/local/bin/xml unesc | \ while read _name _udma _harddiskstandby _apm _acoustic; do # Calculate the channel and device ids. _devnum=${_name#*ad} _channel=$(( ${_devnum} / 2 )) _device=$(( ${_devnum} % 2 )) # If UDMA mode is forced, launch atacontrol. if [ "auto" != "${_udma}" ]; then /sbin/atacontrol mode ${_name} ${_udma} > /dev/null 2>&1 fi # Set command args. _cmdargs="" if [ ${_acoustic} != 0 ]; then _cmdargs="${_cmdargs} -A ${_acoustic}" fi if [ ${_apm} != 0 ]; then _cmdargs="${_cmdargs} -P ${_apm}" fi if [ ${_harddiskstandby} != 0 ]; then _cmdargs="${_cmdargs} -S ${_harddiskstandby}" fi /usr/local/sbin/ataidle ${_cmdargs} ${_channel} ${_device} > /dev/null 2>&1 # Print out some disk informations. echo -n "${_name} " done # Finally do a line break. echo