Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Wish to suspend computer after a certain long-duration activity is finished. i.e. want to go to bed but not leave computer on all night
# to run it optionally give it amount of seconds to wait
# e.g. two hours 7200, e.g. 10 mins 600
echo e.g. invoke: sudo ~/bin/ 7200
[[ "$USER" != "root" ]] && echo must run this as root. && exit 0;
[[ "$1" != "" ]] && SLEEP=$1
which pm-suspend
[[ "$?" != 0 ]] && echo "Oh dear, I cannot run pm-suspend. This script will not work :-7"
echo will suspend after sleep=$SLEEP secs. USER=$USER
sleep $SLEEP && pm-suspend
# pmi action suspend
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.