Disable Energy Saver options while running Casper policies?

Contributor III

Hello all,

I am having a problem with my remote installs where a computer will be online at the beginning of a policy deployment, but will go into power save mode (hibernate? apologies if my terminology is off) in the middle of the deployment and cause it to fail. The package I'm having the most trouble with is Microsoft Office 2011 since it is so huge.

I found where I can set Energy Saver settings under Configuration Profiles, but I'd really like to have a way to just disable Energy Saver options WHILE a policy is being pushed, so users can retain some control over their Energy Saver preferences. This is happening whether I run sudo jamf policy or schedule the install for the check-in.

Has anyone else dealt with this issue? I feel like it may come down to a script but would love to hear about any other tricks anyone is using.

Thanks in advance for any potential help with this problem!



Esteemed Contributor
Esteemed Contributor

Hi @cpdecker,

Are you using HTTP/S or AFP/SMB distribution points?

Esteemed Contributor II

man caffeinate


Contributor III

@bentoms - We are using a Windows Server for the JSS so I am 99% sure it's SMB.

@donmontalvo - I thought this was a joke, but decided to type it anyway. I'll be checking caffeinate out, thanks!


You could also setup your policy to run a script before and after.

The before script will save the settings to a temp file and then tell the computer and hard disk not to sleep

systemsetup -getsleep > /tmp/pre-energy
systemsetup -setsleep 0
systemsetup -setharddisksleep 0

The file should look like this

Sleep: Computer sleeps Never Sleep: Display sleeps after 10 minutes Sleep: Disk sleeps after 10 minutes

Then the after script will read in the setting from the saved file and reset them back to their original values. Then remove the saved temp file.

if [ "`cat /tmp/pre-energy | grep Computer | awk '{print $4}'`" == "Never" ]; then
  preNRG_Computer=`cat /tmp/pre-energy | grep Computer | awk '{print $5}'`

if [ "`cat /tmp/pre-energy | grep Dispaly | awk '{print $4}'`" == "Never" ]; then
  preNRG_Dispaly=`cat /tmp/pre-energy | grep Dispaly | awk '{print $5}'`

if [ "`cat /tmp/pre-energy | grep Disk | awk '{print $4}'`" == "Never" ]; then
  preNRG_Disk=`cat /tmp/pre-energy | grep Disk | awk '{print $5}'`

systemsetup -setsleep $preNRG_Computer
systemsetup -setdisplaysleep $preNRG_Dispaly
systemsetup -setharddisksleep $preNRG_Disk
rm -f /tmp/pre-energy

I have tested the commands and if statements on 10.9.3 - you may have to test and adapt it to other environments.