OS X: Energy Saving Profiles Suddenly Not Working?

obi-k
Valued Contributor III

Hello,

Once we upgraded to Yosemite for the school year, our Energy Savings Profile stopped working. I confirmed with the logs that it wakes up in the morning, but does not shut down. When I go to System Preferences to confirm that the profile being pushed was received on the client end, I see the profile.

I tried changing the settings around, and see that the Mac gets the change, but it still does not shut down.

Our Macs are on 10.10.3 and up, and we are on JSS 9.63.

71a611f4884d40e5827e71efd19c081c

1 ACCEPTED SOLUTION

Aziz
Valued Contributor

This is intended behavior for OS X Yosemite. Which I find pretty dumb.

https://support.apple.com/kb/PH18583?locale=en_US

Your Mac must be awake and you must be logged in for it to shut down at the scheduled time. If you are not logged in or your Mac is in sleep, it won’t shut down.

Here's a launch daemon that shutdowns the machine at 11 PM, I then use a config profile to power them back on.

Package as a .pkg and deploy

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
    <key>Label</key>
<string>com.org.shutdown</string>
<key>UserName</key>
<string>root</string>
<key>Program</key>
<string>/sbin/shutdown</string>
<key>ProgramArguments</key>
<array>
    <string>/sbin/shutdown</string>
    <string>-h</string>
    <string>now</string>
</array>
<key>StartCalendarInterval</key>
<dict>
    <key>Hour</key>
    <integer>23</integer>
    <key>Minute</key>
    <integer>00</integer>
</dict>
</dict>
</plist>

Post flight (After script)

#!/bin/bash
chown root "/Library/LaunchDaemons/com.org.shutdown.plist"
chmod 644 "/Library/LaunchDaemons/com.org.shutdown.plist"
launchctl load -w "/Library/LaunchDaemons/com.org.shutdown.plist"

View solution in original post

6 REPLIES 6

obi-k
Valued Contributor III

Another note I forgot: Our laptops shutdown, but the desktops stay on.

Aziz
Valued Contributor

This is intended behavior for OS X Yosemite. Which I find pretty dumb.

https://support.apple.com/kb/PH18583?locale=en_US

Your Mac must be awake and you must be logged in for it to shut down at the scheduled time. If you are not logged in or your Mac is in sleep, it won’t shut down.

Here's a launch daemon that shutdowns the machine at 11 PM, I then use a config profile to power them back on.

Package as a .pkg and deploy

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
    <key>Label</key>
<string>com.org.shutdown</string>
<key>UserName</key>
<string>root</string>
<key>Program</key>
<string>/sbin/shutdown</string>
<key>ProgramArguments</key>
<array>
    <string>/sbin/shutdown</string>
    <string>-h</string>
    <string>now</string>
</array>
<key>StartCalendarInterval</key>
<dict>
    <key>Hour</key>
    <integer>23</integer>
    <key>Minute</key>
    <integer>00</integer>
</dict>
</dict>
</plist>

Post flight (After script)

#!/bin/bash
chown root "/Library/LaunchDaemons/com.org.shutdown.plist"
chmod 644 "/Library/LaunchDaemons/com.org.shutdown.plist"
launchctl load -w "/Library/LaunchDaemons/com.org.shutdown.plist"

obi-k
Valued Contributor III

Terrific. Thanks so much.

mikeh
Contributor II

Are you kidding me? I fully agree that that is pretty dumb.

And thank you both, for asking the question and providing the answer. I was tearing my hair out trying to figure out why my lab computers weren't shutting down as intended.

jgwatson
Contributor

How do you create the launch daemon, and package it?

:(

Aziz
Valued Contributor

@jgwatson

Quick rundown:

I recommend downloading a nice text editor (I use Textwrangelr).

http://www.barebones.com/products/textwrangler/

Paste the script below into a text editor

optional image ALT text

Drop the .plist into /Library/LaunchAgents, then drag it into Composer

optional image ALT text

Make a post flight script. Not needed if computer is restated

optional image ALT text

Package it as .pkg and upload to Casper Admin