Skip to content

Instantly share code, notes, and snippets.

@nickbrowne
Last active June 20, 2018 03:58
Show Gist options
  • Save nickbrowne/c3a9b57980c640b7e7969990f5f19e97 to your computer and use it in GitHub Desktop.
Save nickbrowne/c3a9b57980c640b7e7969990f5f19e97 to your computer and use it in GitHub Desktop.

A cron job to check the lid state and re-issue a suspend command.

sudo crontab -e

Add this

* * * * * /bin/bash -c 'lid_state=$(cat /proc/acpi/button/lid/LID0/state); case $lid_state in *closed*) systemctl suspend ;; esac'

No more stupid laptop waking up forever and wasting battery while the lid is closed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment