[Ubuntucat-info] Ubuntu i la vida dels discos durs dels portàtils

Sisco siscubuntu a gmail.com
diu oct 28 20:00:29 CET 2007


Pel que fa a l'script en qüestió, he mirat què deia el meu i tinc les dues
opcions, tant el fitxer habilitat com inhabilitat. Quin és el  bo?

 #!/bin/bash

. /etc/default/acpi-support
. /usr/share/acpi-support/power-funcs

function laptop_mode_enable {
    $LAPTOP_MODE start

    for x in /sys/bus/ide/devices/*/block; do
    drive=$(basename $(readlink $x));
    $HDPARM -S $SPINDOWN_TIME /dev/$drive 2>/dev/null
    $HDPARM -B 1 /dev/$drive 2>/dev/null
    done

    for x in /sys/bus/scsi/devices/*/block; do
    drive=$(basename $(readlink $x));
    $HDPARM -S $SPINDOWN_TIME /dev/$drive 2>/dev/null
    $HDPARM -B 1 /dev/$drive 2>/dev/null
    done
}

function laptop_mode_disable {
    for x in /sys/bus/ide/devices/*/block; do
    drive=$(basename $(readlink $x));
    $HDPARM -S 0 /dev/$drive 2>/dev/null
    $HDPARM -B 255 /dev/$drive 2>/dev/null
    done
    for x in /sys/bus/scsi/devices/*/block; do
    drive=$(basename $(readlink $x));
    $HDPARM -S 0 /dev/$drive 2>/dev/null
    $HDPARM -B 255 /dev/$drive 2>/dev/null
    done
    $LAPTOP_MODE stop
}

getState;

checkStateChanged;

shopt -s nullglob

for x in /proc/acpi/ac_adapter/*; do
    grep -q off-line $x/state

    if [ $? = 0 ] && [ x$1 != xstop ]; then
    for SCRIPT in /etc/acpi/battery.d/*.sh; do
        . $SCRIPT
    done
    if [ x$ENABLE_LAPTOP_MODE = xtrue ]; then
        (sleep 5 && laptop_mode_enable)&
    fi
    else
    for SCRIPT in /etc/acpi/ac.d/*.sh; do
        . $SCRIPT
    done
    if [ x$ENABLE_LAPTOP_MODE = xtrue ]; then
        (sleep 5 && laptop_mode_disable)&
    fi
    fi
done

-- 
P Abans d'imprimir aquest correu pensa bé si és necessari fer-ho.
-------------- part següent --------------
Un document HTML ha estat eliminat...
URL: <http://llistes.cpl.upc.edu/pipermail/ubuntucat-info/attachments/20071028/c46e19f6/attachment.html>


Més informació sobre la llista de correu Ubuntucat-info