Слишком свежо, поэтому костылики.
```
#!/bin/bash
apcaccess | awk '/STATUS/ {print $3}' >> /tmp/apcacess_bat.log
apcaccess | awk '/BCHARGE/ {print $3}' >> /tmp/apcacess_bat.log
if grep 'ONLINE' /tmp/apcacess_bat.log; then
echo ONLINE
rm /tmp/apcacess_bat.log
elif grep '25.0' /tmp/apcacess_bat.log; then
echo calm cat dreams ^.^
sleep 1
poweroff
else
echo « ПУК »
rm /tmp/apcacess_bat.log
fi
```