cem-utils

Random utilities
git clone git://git.ckyln.com/~cem/cem-utils.git
Log | Files | Refs | README

nap (531B)


      1 #!/bin/sh
      2 # nap - not the full zzz, but a light one
      3 
      4 [ "$1" ] && { printf 'Usage: %s\nThere are not many options when taking a nap.\n' "${0##*/}" ; exit 1 ;}
      5 grep -q mem /sys/power/state || { printf "Suspend not supported.\n"; exit 1 ;}
      6 test -w /sys/power/state || { printf "Sleep permission denied.\n" ; exit 1 ;}
      7 for hook in /etc/zzz.d/suspend/* ; do [ -x "$hook" ] && "$hook" ; done
      8 printf mem >/sys/power/state || { printf "Could not suspend.\n" ; exit 1 ;}
      9 for hook in /etc/zzz.d/resume/*; do [ -x "$hook" ] && "$hook" ; done