Last active
May 4, 2025 14:02
-
-
Save kaihendry/fda6fca28d9273b68ed7bae7bd10b810 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Check if running on battery (optional, but good practice) | |
on_ac=$(acpi -a | grep -c "on-line") | |
if [ "$on_ac" -eq 0 ]; then | |
logger "Power loss detected (ACPI event), initiating suspend." | |
systemctl suspend | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment