-
Notifications
You must be signed in to change notification settings - Fork 4
/
secure-sleep.sh
executable file
·36 lines (35 loc) · 1.12 KB
/
secure-sleep.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#!/bin/bash
# This is close to standard safe sleep, but dark wakes are turned off
# and Filevault key is requested after standby has been triggered.
# THIS IS LIKELY TO CRASH YOUR MAC!!!!
# THIS SCRIPT IS FOR REFERENCE
# Must be run as root!
pmset restoredefaults
# Throw away key when going into hibernation (standby)
pmset -a destroyfvkeyonstandby 1
# Standard safe sleep to memory first, then hibernate
pmset -a hibernatemode 3
# Use standby
pmset -a standby 1
# Wait time before entering hibernation (in seconds)
pmset -a standbydelay 1800
# Sleep on battery after 10 min
pmset -b sleep 10
# Sleep on power after 15 min
pmset -c sleep 15
# Don't do powernaps
pmset -a powernap 0
# Don't wake up on WIFI/network connections
pmset -a tcpkeepalive 0
# Don't wake on magic Ethernet packets
pmset -a womp 0
# Ignore any ttys/ssh connected
pmset -a ttyskeepawake 0
# Do not wake up on AC connected
pmset -a acwake 0
# Turn autopoweroff off when on battery = standby (in seconds!)
pmset -b autopoweroff 0
pmset -b autopoweroffdelay 0
# Turn autopoweroff on when on power = standby (in seconds!)
pmset -c autopoweroff 1
pmset -c autopoweroffdelay 1800