-
-
Save cemkeylan/2b989cc072f0bd415cae4603131809b3 to your computer and use it in GitHub Desktop.
This file contains hidden or 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/sh | |
# nap - not the full zzz, but a light one | |
usage() { printf 'Usage: %s\nThere are not many options when taking a nap.\n' "${0##*/}" ; exit 1 ;} | |
[ "$1" ] && usage | |
grep -q mem /sys/power/state || { printf "Suspend not supported.\n"; exit 1 ;} | |
test -w /sys/power/state || { printf "Sleep permission denied.\n" ; exit 1 ;} | |
for hook in /etc/zzz.d/suspend/* ; do | |
[ -x "$hook" ] && "$hook" | |
done | |
printf mem >/sys/power/state || { printf "Could not suspend.\n" ; exit 1 ;} | |
for hook in /etc/zzz.d/resume/*; do | |
[ -x "$hook" ] && "$hook" | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment