Skip to content

Instantly share code, notes, and snippets.

@joaopfsilva
Created June 5, 2023 23:58
Show Gist options
  • Save joaopfsilva/6757c9b34d1f17fa3350afbd83dc26cd to your computer and use it in GitHub Desktop.
Save joaopfsilva/6757c9b34d1f17fa3350afbd83dc26cd to your computer and use it in GitHub Desktop.
#!/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