-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathsuspend.sh
More file actions
20 lines (19 loc) · 722 Bytes
/
suspend.sh
File metadata and controls
20 lines (19 loc) · 722 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
#!/bin/bash
# https://bbs.archlinux.org/viewtopic.php?pid=1512908#p1512908
#!/bin/bash
POSSIBLE=$(cat /sys/power/state)
if [ $# -gt 0 ]; then
if [[ $POSSIBLE == *"$1"* ]]; then
echo $1 > /sys/power/state
else
echo "This mode is not supported on this device."
fi
else
echo "Usage: state [state]"
echo "state The state to set the computer to."
echo " Possible values:"
[[ $POSSIBLE == *"freeze"* ]] && echo " 0 freeze Suspend to idle (software-based)"
[[ $POSSIBLE == *"standby"* ]] && echo " 1 standby Stand-by (power-on suspend)"
[[ $POSSIBLE == *"mem"* ]] && echo " 3 mem Suspend to RAM (sleep)"
[[ $POSSIBLE == *"disk"* ]] && echo " 4 disk Suspend to disk (hibernate)"
fi