Skip to content

Instantly share code, notes, and snippets.

@mrl22
Created February 2, 2024 20:50
Show Gist options
  • Save mrl22/b38ae7a9e74b261ad91146b080ea72c2 to your computer and use it in GitHub Desktop.
Save mrl22/b38ae7a9e74b261ad91146b080ea72c2 to your computer and use it in GitHub Desktop.
APCUPSD / APCACCCESS - Get power consumption in Watts.
#!/usr/bin/sh
APC=$(apcaccess status)
NOMPOWER=$(echo "$APC"|grep NOMPOWER|cut -d' ' -f3)
LOADPCT=$(echo "$APC"|grep LOADPCT|cut -d' ' -f4)
WATTS=$(echo "$NOMPOWER / $LOADPCT"|bc)
echo "$WATTS Watts"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment