Created
June 5, 2023 23:58
-
-
Save joaopfsilva/6757c9b34d1f17fa3350afbd83dc26cd to your computer and use it in GitHub Desktop.
This file contains 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 | |
if [ $# -ne 1 ]; then | |
echo "Usage: $0 <option>" | |
exit 1 | |
fi | |
option=$1 | |
case "$option" in | |
"off") | |
sudo pmset -a sleep 0 | |
sudo pmset -a hibernatemode 0 | |
sudo pmset -a disablesleep 1 | |
;; | |
"on") | |
sudo pmset -a sleep 1 | |
sudo pmset -a hibernatemode 3 | |
sudo pmset -a disablesleep 0 | |
;; | |
*) | |
echo "Invalid option: $option" | |
exit 1 | |
;; | |
esac | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment