Jump to content

tseug

tseug

Member Since 16 Feb 2008
Offline Last Active Nov 18 2014 06:17 PM
*****

Posts I've Made

In Topic: Wake reason: RTC (Alarm) - how to deactivate?

04 November 2014 - 08:09 PM

Other than checking the log for wake events is there a way to check discoveryd was disabled and re-enabled?

 

Well, you obviously can't check if discoveryd is unloaded during sleep directly, but you can check that it is loaded (the sudo is very important here so make sure to remember it):

 

sudo launchctl list | grep com.apple.networking.discoveryd

 

This should return something. Otherwise discoveryd is not loaded.

 

Another thing you can try before adding /Library/LaunchDaemons/de.bernhard-baehr.sleepwatcher.plist is to check and see if your rc scripts work. I.e

 

/usr/local/sbin/sleepwatcher -V -s /etc/rc.sleep in a terminal and then try to sleep or

/usr/local/sbin/sleepwatcher -V -s /etc/rc.sleep -w /etc/rc.wakeup and then try to sleep

 

In both these cases the terminal window will not report anything until you actually wake up from sleep again, and you have to initiate sleep manually (or wait until automatic sleep). Enter CTRL+C to stop SleepWatcher  after testing.

 

Refer to the SleepWatcher documentation for more details.

In Topic: Wake reason: RTC (Alarm) - how to deactivate?

04 November 2014 - 09:47 AM

Are you really sure that "-s /etc/rc.wakeup" and "-w /etc/rc.sleep" should be right ?

-s is for sleep command , therefore it should be rc.sleep ?

Maybe you must alter your original post , again ;-) ?

 

Regards,

 

Markus

You're absolutely right. Yet another edit. Thanks :)

 

By the way, wake on LAN does not need to be disabled for this configuration to work.

In Topic: Wake reason: RTC (Alarm) - how to deactivate?

02 November 2014 - 07:59 PM

This looks like a good idea.  The only thing I would try differently is to use launchctl stop and start instead of load and unload. 

 

EDIT: It now works. I changed the configuration in the original post to reflect this.

 

To check that it is working:

pmset -g log | grep DarkWake

In Topic: Wake reason: RTC (Alarm) - how to deactivate?

02 November 2014 - 04:31 PM

Another approach which might be more future proof is to just unload discoveryd when the machine is about to go to sleep and then load it again at wakeup. Sleepwatcher can be used to run scripts at sleep and wakeup events. My /Library/LaunchDaemons/de.bernhard-baehr.sleepwatcher.plist looks like this:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
	<key>Label</key>
	<string>de.bernhard-baehr.sleepwatcher</string>
	<key>ProgramArguments</key>
	<array>
		<string>/usr/local/sbin/sleepwatcher</string>
		<string>-V</string>
		<string>-s /etc/rc.sleep</string>
		<string>-w /etc/rc.wakeup</string>
	</array>
	<key>RunAtLoad</key>
	<true/>
	<key>KeepAlive</key>
	<true/>
</dict>
</plist>

/etc/rc.sleep:


#!/bin/sh
# Unload discoveryd to disable maintenance wakeup every two hours
launchctl unload /System/Library/LaunchDaemons/com.apple.discoveryd.plist

 
/etc/rc.wakeup:

#!/bin/sh
# Load discoveryd to enable network
launchctl load /System/Library/LaunchDaemons/com.apple.discoveryd.plist

EDIT: Changed to working configuration

© 2014 InsanelyMac  |   News  |   Forum  |   Downloads  |   OSx86 Wiki  |   Mac Netbook  |   PHP hosting by CatN  |   Designed by Ed Gain  |   Logo by irfan  |   Privacy Policy