lu.se

Datavetenskap

Lunds Tekniska Högskola

Denna sida på svenska This page in English

sleep_info.sh

sleep_info.sh is a bash-script written for OS X 10.10 “Yosemite” that tell you about the current setting for the computer regarding sleep and when/why it fell asleep/awoke (that part requires you to be admin user). If something is preventing the computer from sleeping, you will see what it is!

This is a typical output from a terminal session (running as an admin user):

Sleep info for: driftthunder.cs.lth.se   Running: Mac OS X 10.10.1   Date & time: 2014-12-05, 10:52

Recent sleep/wake history
• Previous Sleep Cause: Idle Sleep (kIOPMIdleSleepKey) on Dec 6 22:21:17
• The computer woke up on Dec 6 22:27:52 because of "XHC1" (a BlueTooth-device is waking your computer)

Hibernation
Hibernation mode: 0 (memory not backed up to disk)
Hibernation file: /var/vm/sleepimage (2,0G), changed 6 Dec 22:21

Power Settings
The computer is running on: AC Power
• The system is set to sleep after 30 minutes
• The display is set to sleep after 30 minutes
• The disk is set to sleep after 10 minutes
However, system sleep is currently prevented by:
- "screensharingd" (Remote user is connected; Remote user active, process id 7198, run by "root")
- "backupd" (Time Machine backup; Time Machine backup, process id 42311, run by "root")

Note: to make the computer sleep right away, type "pmset sleepnow"
Note: to make the computer not sleep, type "caffeinate -i"

This is the script output when run as a non-admin:

Sleep info for: petermol.cs.lth.se   Running: Mac OS X 10.10.1 (Server 4)   Date & time: 2014-12-05, 13:16

Recent sleep/wake history
Sorry, user "peter" is not an admin-user and can't read sleep/wake reasons from syslog!

Hibernation
Hibernation mode 3 (copy of memory stored on disk; RAM is powered on)
Hibernation file: /var/vm/sleepimage (16,0G), changed 6 Dec 18:43

Power Settings
The computer is running on: AC Power
• The system is set to sleep after 40 minutes
• The display is set to sleep after 40 minutes
• The disk is set to sleep after 10 minutes
However, system sleep is currently prevented by:
- "coreaudiod" (process id 405, run by "_coreaudiod")
- "iTunes" (process id 4370, run by "peter")
- "com.apple.serverd" (com.apple.server.filesharing; com.apple.collabd, process id 34, run by "root")
- "com.apple.serverd" (com.apple.server.filesharing; com.apple.collabd, process id 34, run by "root")

Note: to make the computer sleep right away, type "pmset sleepnow"
Note: to make the computer not sleep, type "caffeinate -i"

You get the script from here:
http://fileadmin.cs.lth.se/cs/Personal/Peter_Moller/scripts/sleep_info.sh

The you must set the correct access rights on the file so that you can run it:
chmod 755 sleep_info.sh

The only option to the script is -u that updates it to the latest version.

sha1-checksum for sleep_info.sh:

Hint

If you want the computer to sleep right away, type the command:
pmset sleepnow

If you want the computer not to sleep, type the command:
caffeinate -i