Skip to content

Instantly share code, notes, and snippets.

@VMuliadi
Last active November 23, 2024 12:31
Show Gist options
  • Save VMuliadi/8d2798e6a93afdba1803e4113e618382 to your computer and use it in GitHub Desktop.
Save VMuliadi/8d2798e6a93afdba1803e4113e618382 to your computer and use it in GitHub Desktop.
Allow Linux computer to keep working even the lid was closed. Tested on Linux Fedora 29
#!/bin/bash
sudo sed -i 's|#HandleLidSwitch=suspend|HandleLidSwitch=ignore|g' /etc/systemd/logind.conf
read -p "Are you going to restart your computer (y to restart)?" confirmation
if [[ $(echo ${confirmation}) == y || $(echo ${confirmation}) == Y ]]; then
sudo reboot
else echo "DONE"
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment