HT202824: OS X: Saving energy with Sleep

Learn about OS X: Saving energy with Sleep
tim.rohrer

Q: How do Power Nap, Standby Mode & AutoPowerOff play together?

Good morning,

 

Background/System & Configuration: This is related to a small office network for which I have written a custom backup script that I am testing before deploying. The script rsyncs selected files from the workstation (2013 Mac Pro, OS X 10.11.6) to the server via wifi through an Airport Extreme. Password-less SSH is used by root to connect from the workstation to the server. The server is a Late 2014 Mac Mini (OS X 10.11.6/Server 5.1.7) set to not sleep.

 

The script is loaded from launchd and is set to run at designated times throughout the day and night. It seems to work fine when the workstation is awake. I have read that launchd will run scheduled events when a computer wakes from sleep. What I actually seem to experience at night (when I am personally in sleep mode) is that the script will run intermittently (i.e., not at the scheduled times) but it fails because the initial SSH (from rsync) operation times out. The server's full hostname is used in the script, vice the IP address.

 

On the workstation, Power Nap is enabled and the computer is allowed to sleep. pmset standbydelay=10800 (3 hrs) and autopoweroffdelay=14400 (4 hrs). My understanding is that information in Mail, Notes, Contacts, etc., will only be updated if those apps are running; on my computer, I believe Notes was the only one running over night.

 

Assumptions:

1) Power Nap is allowing the script to run because the computer has partial wake-ups during the night.

2) The script is falling at night because the workstation's energy saving modes do not allow DNS queries.

 

Next Test: I will set standbydelay and autopoweroffdelay each to 12 hours and see if the script runs correctly tonight.

 

Questions:

1) Do my assumptions seem valid?

2) Which of these energy sleep modes disables DNS lookups or other network activity?

3) Does anyone have a link to good documentation describing the technical interactions between services when Power Nap is active?

 

Thanks in advance.

Mac Pro, OS X El Capitan (10.11.6), null

Posted on Aug 19, 2016 6:25 AM

Close

Q: How do Power Nap, Standby Mode & AutoPowerOff play together?

  • All replies
  • Helpful answers

  • by tim.rohrer,

    tim.rohrer tim.rohrer Aug 21, 2016 12:43 PM in response to tim.rohrer
    Level 1 (36 points)
    Servers Enterprise
    Aug 21, 2016 12:43 PM in response to tim.rohrer

    UPDATE: Changing the standbydelay and autopoweroffdelay each to 12 hours seems to allow the script to run. The run does not occur at the scheduled time so I believe it is occurring when something else wakes the computer (power nap is enabled). However, I seem far more likely to get broken pipes over night than I do during the day, and I'm troubleshooting this.

     

    On the server, I've confirmed by searching the pmset log that the computer is not being reported as being put to sleep, so now I'm trying to trouble shoot other things that might cause some part of the network to not perform properly.

     

    While I think I've answered my first question (i.e., valid assumptions), I'm still looking for help with question 3.

     

    Thanks.

  • by dwbrecovery,

    dwbrecovery dwbrecovery Aug 21, 2016 8:21 PM in response to tim.rohrer
    Level 3 (510 points)
    Servers Enterprise
    Aug 21, 2016 8:21 PM in response to tim.rohrer

    Hi tim.roher,

    Check out  man pmset and man caffeinate. 

    From the output of command pmset -g ,  is  networkoversleep set to 1 on your workstation?

     

    For my workstations ( old ), they are set to 0 and the value cannot be changed.  I use Apple Remote Desktop to wake the workstations before I run any scripts.

     

    You may be able to use /usr/bin/caffeinate to fork your process -  rsync/ssh which will prevent sleep until complete.

     

    Cheers

  • by tim.rohrer,

    tim.rohrer tim.rohrer Aug 22, 2016 10:41 AM in response to dwbrecovery
    Level 1 (36 points)
    Servers Enterprise
    Aug 22, 2016 10:41 AM in response to dwbrecovery

    Thanks for the reply, dwbrecovery.

     

    Although I have not used caffeinate, I'm aware it is something that might help, and I may implement it as a test. I use pmset to change settings; here are were the current settings on the primary workstation I'm using for testing:

     

    System-wide power settings:
    SleepDisabled 0
    DestroyFVKeyOnStandby 0
    Active Profiles:
    AC Power -1*
    Currently in use:
    standby              1
    Sleep On Power Button 1
    womp                 1
    autorestart          0
    hibernatefile        /var/vm/sleepimage
    powernap             1
    gpuswitch            2
    networkoversleep     0
    disksleep            10
    sleep                1
    autopoweroffdelay    43200
    hibernatemode        0
    autopoweroff         1
    ttyskeepawake        1
    displaysleep         10
    standbydelay         43200
    

     

    Both delays are set for 12 hours. I realize now disk sleep is 10 mins, but that should not be relevant since the process is being run from this computer.

     

    Yes, networkoversleep is was set to 0, and the man page indicates changing it is not supported. But, I just changed it to 1 so we'll see what impact that has tonight :-)

     

    For starters, I'm trying to understand the technologies related to sleep/standby/etc. For example, on the primary workstation I'm using for testing, I modified the ssh_config to poke at the server every 30 seconds during an ssh session (admittedly, I'm not sure of how rsync releases/retains ssh after the initial connect/authentication).  On this workstation, over night, the first cycle when the rsync script is being run, the pipe broke. Later when ran a 2nd time, the error indicated the network was down. Now, it is important for me to note that I arrived at my desk to find another problem with the workstation, which I'm going to write up later today.

     

    Also, I have the same set of scripts installed on a couple of other computers, both laptops. On one, the script doesn't run at all at night. On the other, it seems to generally run better than on my main workstation (Mac Pro).

     

    Because of the broken pipes and the recurring occasional problem like I experienced this morning (not able to unlock the account; odutil show nodenames reported /LDAPv3/<server> as not online), I'm not ruling out something wrong with the network. Sigh...

  • by dwbrecovery,Apple recommended

    dwbrecovery dwbrecovery Aug 24, 2016 5:19 PM in response to tim.rohrer
    Level 3 (510 points)
    Servers Enterprise
    Aug 24, 2016 5:19 PM in response to tim.rohrer

    Hi Tim,

    Disable power management on your Server and Workstations until all scripts, logins etc. are functioning.  Then reintroduce gradually the power mgmt. settings, checking functionality at each step.

     

    i.e.: - Disable all sleep & wake schedules and settings, within System Preferences -> Energy Saver  and perform SMC resets on the Server and Workstations.  Refer:  Reset the System Management Controller (SMC) on your Mac - Apple Support

     

    HTH

    Cheers, dwbrecovery

  • by tim.rohrer,

    tim.rohrer tim.rohrer Aug 25, 2016 6:48 PM in response to dwbrecovery
    Level 1 (36 points)
    Servers Enterprise
    Aug 25, 2016 6:48 PM in response to dwbrecovery

    dwbrecovery,

     

    Thank you. I like that approach, and will take a stab at it.

    ====

    p.s., I don't understand specifically what Apple recommended means, but I noticed a green check mark is showing as if this is solved. While I appreciate Apple(?) endorsing the solution, which is helpful, I would still like to see question 3 answered. Specifically, details on the functional interactions between the types of power mode settings.

     

    Tim

  • by dwbrecovery,

    dwbrecovery dwbrecovery Aug 25, 2016 9:24 PM in response to tim.rohrer
    Level 3 (510 points)
    Servers Enterprise
    Aug 25, 2016 9:24 PM in response to tim.rohrer

    Hi Tim,

    The Link below goes deeper into power management

    https://developer.apple.com/library/mac/documentation/DeviceDrivers/Conceptual/I OKitFundamentals/PowerMgmt/PowerMgmt.htm…

     

    Always, HTH

    Cheers,  dwbrecovery