Linux, APC: How to show status of the APC UPS in Linux?

robert@localhost$ apcaccess status

Show only STATUS: online or battery.
robert@localhost$ apcaccess status | grep STATUS | awk ‚{print $3}’

Ok, write small script to check if UPS is online.
Create file, put below code inside of the file, write the file, add execute permission to file (chmod +x

$status=`apcaccess status | grep STATUS | awk ‚{print $3}’`

if [ $status == „ONLINE” ]; then
echo „ONLINE”
exit 0
echo „ON BATTERY” | mailx -s „APC Status”

„command”, ‚command’ – command is a string and go to variable
`command` – command is executed and output go to variable