New file |
| | |
| | | #!/bin/ksh |
| | | |
| | | UDI="/org/freedesktop/Hal/devices/pseudo/acpi_drv_0_battery0_0" |
| | | |
| | | halout=$(/usr/sbin/lshal -l -u ${UDI}) |
| | | |
| | | perc=$(printf "${halout}" | nawk '$1~/battery.charge_level.percentage/ { print $3 }') |
| | | if [ x$(printf "${halout}" | nawk '$1~/battery.rechargeable.is_charging/ { print $3 }') == xtrue ]; then |
| | | string="battery is charging" |
| | | cstring="charge time" |
| | | elif [ x$(printf "${halout}" | nawk '$1~/battery.rechargeable.is_discharging/ { print $3 }') == xtrue ]; then |
| | | string="battery is discharging" |
| | | cstring="run time" |
| | | else |
| | | string="battery is charged and runs on external power" |
| | | cstring="run time" |
| | | fi |
| | | runtime=$(( $(printf "${halout}" | nawk '$1~/battery.remaining_time/ { print $3 }') / 60 )) |
| | | |
| | | printf "I: the %s at %s%%, expected %s is %i min.\n" "$string" $perc "$cstring" $runtime |
| | | |