Letting the server machine sleep (macOS)

I’m noticing that the display attached to my Mac Mini that runs the DVR no longer seems to sleep. Is this possibly a side effect of the changes made here?

Don’t think so… you can run the following command in terminal to see what’s keeping the display active:

pmset -g assertions

I tried to let my 2010 Mac Mini sleep and it missed two recordings today. I see in the log that they were scheduled but did not start.

For the second recording, I launched Channels on ATV while the program I wanted to record was still on. The Mac Mini woke and started the at that time.

Any ideas on what to check? I’m running 10.10.5 but could upgrade to 10.11.

In order to enable this, you have to run the following commands in Terminal:

cd ~/channels-dvr
curl -fo install.sh https://getchannels.com/dvr/install-darwin.sh
./install.sh --wake-helper

It will ask for your password, and setup a sudo helper for the DVR to be able to wake up when it needs to.

Thanks. I missed that in your earlier post!

soo

I ran that script and now my iMac won’t sleep at all… Screen is not turning off after 5 minutes like it’s supposed to. Neither is the screen saver. Heck, I won’t even go to sleep manually when using “suspend activity” in the Apple menu. Screen goes black and them comes back right up.

I need help.

Can you run pmset -g assertions in Terminal.app and post the output?

Here it is

Assertion status system-wide:
   BackgroundTask                 0
   ApplePushServiceTask           0
   UserIsActive                   1
   PreventUserIdleDisplaySleep    0
   PreventSystemSleep             0
   ExternalMedia                  1
   PreventUserIdleSystemSleep     1
   NetworkClientActive            1
Listed by owning process:
   pid 2015(smbd): [0x000050d10011931f] 00:01:05 NetworkClientActive named: "com.apple.smbd" 
   pid 2015(smbd): [0x000050cf0011931d] 00:01:07 NetworkClientActive named: "com.apple.smbd" 
   pid 107(hidd): [0x000050d70009932a] 00:00:59 UserIsActive named: "com.apple.iohideventsystem.queue.tickle.4294968985.17" 
	Timeout will fire in 298 secs Action=TimeoutActionRelease
   pid 1447(channels-dvr): [0x00004a3d0001923c] 00:29:10 PreventUserIdleSystemSleep named: "DVR Engine Activity" 
   pid 421(useractivityd): [0x000051110001933a] 00:00:01 PreventUserIdleSystemSleep named: "BTLEAdvertisement" 
   pid 53(powerd): [0x0000000300088000] 11:42:09 ExternalMedia named: "com.apple.powermanagement.externalmediamounted" 
Kernel Assertions: 0x12c=USB,BT-HID,THNDR,MAGICWAKE
   id=500  level=255 0x20=THNDR mod=17-05-17 20:21 description=NHI0 owner=AppleThunderboltHAL
   id=502  level=255 0x4=USB mod=69-12-31 19:00 description=com.apple.usb.externaldevice.14200000 owner=External
   id=503  level=255 0x4=USB mod=69-12-31 19:00 description=com.apple.usb.externaldevice.14600000 owner=USB2.0 Hub
   id=505  level=255 0x4=USB mod=69-12-31 19:00 description=com.apple.usb.externaldevice.14800000 owner=USB3.0 Hub
   id=507  level=255 0x4=USB mod=69-12-31 19:00 description=com.apple.usb.externaldevice.14700000 owner=USB3.0 Hub             
   id=511  level=255 0x4=USB mod=69-12-31 19:00 description=com.apple.usb.externaldevice.14820000 owner=USB Storage
   id=512  level=255 0x4=USB mod=69-12-31 19:00 description=com.apple.usb.externaldevice.14720000 owner=USB to ATA/ATAPI Bridge
   id=515  level=255 0x4=USB mod=69-12-31 19:00 description=com.apple.usb.externaldevice.14710000 owner=JMS56x Series
   id=516  level=255 0x4=USB mod=69-12-31 19:00 description=com.apple.usb.externaldevice.14740000 owner=External USB 3.0
   id=517  level=255 0x100=MAGICWAKE mod=69-12-31 19:00 description=en1 owner=en1
   id=518  level=255 0x100=MAGICWAKE mod=17-05-17 20:32 description=en0 owner=en0
   id=519  level=255 0x8=BT-HID mod=69-12-31 19:00 description=com.apple.driver.IOBluetoothHIDDriver owner=AppleHSBluetoothDevice
   id=520  level=255 0x8=BT-HID mod=69-12-31 19:00 description=com.apple.driver.IOBluetoothHIDDriver owner=AppleHSBluetoothDevice
   id=558  level=255 0x4=USB mod=69-12-31 19:00 description=com.apple.usb.externaldevice.14300000 owner=USB2.0 Hub             
   id=561  level=255 0x4=USB mod=69-12-31 19:00 description=com.apple.usb.externaldevice.14330000 owner=USB2.0 Hub
Idle sleep preventers: IODisplayWrangler

I have a Macbook Pro that I am using as a server and have experienced crashes during the early morning hours. I suspect that it is related to Channels DVR and Bonjour.

When the Bonjour box is not check I did not have crashes for several days. Bonjour is working as expected for waking for recordings and the computer will sleep. Although, it may take longer to sleep than the time specified energy savings.

It is far from scientific at this point, but I did copy some logs that I captured this morning. Perhaps someone may have encountered a similar problem? Any suggestions on how I may proceed in isolating the cause of the crashes? I will email an additional log.

2017/05/19 00:35:39 [DVR] Starting job 1495164900-15 The Late Show With Stephen Colbert on ch=[47.1]
2017/05/19 00:35:39 [DVR] Waiting 12h24m20.95284984s until next job 1495213200-8 This Old House
2017/05/19 00:35:39 [TNR] Opened connection to 10482E6A for ch47.1
2017/05/19 00:35:39 [DVR] Recording for job 1495164900-15 from 10482E6A ch47.1 into “TV/The Late Show With Stephen Colbert/2017-05-18-2335 The Late Show With Stephen Colbert 2017-05-18 S02E152 Ricky Gervais Corey Hawkins The xx.mpg” for 1m20.952061196s
2017/05/19 00:37:00 [TNR] Closed connection to 10482E6A for ch47.1
2017/05/19 00:37:00 [DVR] Finished job 1495164900-15 The Late Show With Stephen Colbert
2017/05/19 00:37:00 [DVR] Processing file-32: TV/The Late Show With Stephen Colbert/2017-05-18-2335 The Late Show With Stephen Colbert 2017-05-18 S02E152 Ricky Gervais Corey Hawkins The xx.mpg
2017/05/19 00:37:00 [DVR] Waiting 12h22m59.658358707s until next job 1495213200-8 This Old House
2017/05/19 00:37:00 [DVR] Running commercial detection on file 32 (TV/The Late Show With Stephen Colbert/2017-05-18-2335 The Late Show With Stephen Colbert 2017-05-18 S02E152 Ricky Gervais Corey Hawkins The xx.mpg)
2017/05/19 00:37:11 [DVR] Commercial detection finished with 2 markers.
2017/05/19 01:44:07 [SYS] Error checking for update: Get https://channels-dvr.s3.amazonaws.com/latest.json: dial tcp: lookup channels-dvr.s3.amazonaws.com: no such host
2017/05/19 08:15:02 [SYS] Starting Channels DVR v2017.05.17.1932 (darwin-x86_64) in /Users/mesacad/channels-dvr/data
2017/05/19 08:15:03 [HDR] Found 1 devices
2017/05/19 08:15:05 [SYS] Started HTTP Server
2017/05/19 08:15:09 [DVR] Recording engine started in /Users/mesacad/TV Shows
2017/05/19 08:15:09 [DVR] Waiting 4h44m50.782284066s until next job 1495213200-8 This Old House
2017/05/19 08:15:09 [SYS] Created database snapshot: backup-20170519.081509
2017/05/19 08:15:10 [SYS] Bonjour service registered with MacBook-Pro.local
2017/05/19 08:15:19 [IDX] Pruned 198 expired airings from USA-OTA32086 in 224.395807ms.

When you say crashes, can you elaborate on what you’re seeing?

The computer will not respond. The screen is black and I have to hold the power button before it reboots.

So,

Any updates? My computer still is an insomniac… getting frustrating… can I easily uninstall the “wake to record” script?

thanks

Sorry, haven’t had a chance to dig into this.

You can uninstall by running this command:

sudo rm /etc/sudoers.d/channels-dvr

You can also try restarting the DVR via the mac menu at the top of the screen (next to clock/wifi), by clicking the TV icon and selecting Restart.

The DVR should only be preventing sleep when it’s busy… next time you try to sleep it and it refuses, run this command in terminal and post the results:

curl 127.0.0.1:8089/dvr

Last login: Thu May 25 17:56:29 on ttys000
iMac-5k:~ etienne$ curl 127.0.0.1:8089/dvr
{“activity”:{},“busy”:false,“clients”:0,“disk”:{“free”:265016901632,“total”:999860912128,“used”:734844010496},“enabled”:true,“keep”:{“num”:"",“only”:""},“padding”:{“end”:"",“start”:“0”},“path”:"/Volumes/Media Center/DVR",“stats”:{“groups”:27,“files”:229,“jobs”:3,“rules”:4},“status”:“running”}
iMac-5k:~ etienne$

Okay, and just to confirm, if you run pmset -g assertions again it says “DVR Engine Activity”?

I would expect that when the curl command says “busy”:false that the assertion should not be present either. Sounds like things are getting out of sync somewhere.

Here, I ran the Assertions command again :

Last login: Thu May 25 17:56:32 on ttys000
Restored session: Jeu 25 mai 2017 23:36:38 EDT
iMac-5k:~ etienne$ pmset -g assertions
2017-05-26 00:00:15 -0400 
Assertion status system-wide:
   BackgroundTask                 0
   ApplePushServiceTask           0
   UserIsActive                   1
   PreventUserIdleDisplaySleep    0
   PreventSystemSleep             0
   ExternalMedia                  1
   PreventUserIdleSystemSleep     0
   NetworkClientActive            0
Listed by owning process:
   pid 6051(channels-dvr): [0x000176ae00099f2e] 00:00:30 UserIsActive named: "DVR Client Activity" 
	Timeout will fire in 569 secs Action=TimeoutActionRelease
   pid 53(powerd): [0x0000000400088000] 28:20:51 ExternalMedia named: "com.apple.powermanagement.externalmediamounted" 
   pid 107(hidd): [0x00016e0e00099b9e] 00:37:18 UserIsActive named: "com.apple.iohideventsystem.queue.tickle.4294968982.17" 
	Timeout will fire in 594 secs Action=TimeoutActionRelease
Kernel Assertions: 0x10c=USB,BT-HID,MAGICWAKE
   id=502  level=255 0x4=USB mod=69-12-31 19:00 description=com.apple.usb.externaldevice.14200000 owner=External
   id=507  level=255 0x4=USB mod=69-12-31 19:00 description=com.apple.usb.externaldevice.14700000 owner=USB3.0 Hub             
   id=509  level=255 0x4=USB mod=69-12-31 19:00 description=com.apple.usb.externaldevice.14300000 owner=USB2.0 Hub             
   id=514  level=255 0x4=USB mod=69-12-31 19:00 description=com.apple.usb.externaldevice.14720000 owner=USB to ATA/ATAPI Bridge
   id=515  level=255 0x4=USB mod=69-12-31 19:00 description=com.apple.usb.externaldevice.14740000 owner=External USB 3.0
   id=516  level=255 0x100=MAGICWAKE mod=69-12-31 19:00 description=en1 owner=en1
   id=517  level=255 0x100=MAGICWAKE mod=17-05-25 18:37 description=en0 owner=en0
   id=518  level=255 0x8=BT-HID mod=69-12-31 19:00 description=com.apple.driver.IOBluetoothHIDDriver owner=AppleHSBluetoothDevice
   id=519  level=255 0x8=BT-HID mod=69-12-31 19:00 description=com.apple.driver.IOBluetoothHIDDriver owner=AppleHSBluetoothDevice
   id=520  level=255 0x4=USB mod=69-12-31 19:00 description=com.apple.usb.externaldevice.14710000 owner=JMS56x Series
   id=582  level=255 0x4=USB mod=69-12-31 19:00 description=com.apple.usb.externaldevice.14330000 owner=USB2.0 Hub
   id=605  level=255 0x4=USB mod=69-12-31 19:00 description=com.apple.usb.externaldevice.14600000 owner=USB2.0 Hub
   id=607  level=255 0x4=USB mod=69-12-31 19:00 description=com.apple.usb.externaldevice.14800000 owner=USB3.0 Hub
   id=609  level=255 0x4=USB mod=69-12-31 19:00 description=com.apple.usb.externaldevice.14820000 owner=USB Storage
Idle sleep preventers: IODisplayWrangler

I have now uninstalled the script. I will wait untill you get more time to look into this. Tell me if you need me to run it again to help you trouble shoot it.

I will now let my computer sleep and miss a few recordings.

Computer still won’t sleep… don’t know what happened. Maybe it did not uninstalled properly? It was fine before I installed it…

would appreciate some help

Hmm, I see why… the part you uninstalled is for waking up the Mac to make a recording.

But the issue is in the other half, which is inside the DVR and prevents it from sleeping.

What does this command output:

pmset -g assertions | grep -A1 channels-dvr; curl 127.0.0.1:8089/dvr