We are using a policy with custom trigger to run an early morning reboot on lab machines. The policy is made available locally, and it is called using a LaunchDaemon scheduled to run at 5am (sometime around then). The LaunchDaemon is packaged and included during imaging for lab configs. For us, the policy (reboot) only runs if no one is logged onto the Mac. It has worked well for us.
@jrippy The Energy Saver config profile payload has an option to schedule power on & off.
Might be worth a try?
Then maybe a policy that runs at startup once a day.
@jonscott Ok, so you're using a launchdaemon to control the scheduling and initiate the restart policy. Why not just have the launchdaemon do the actual restart as well?
@bentoms You know, I do already have that set to try to force the machines on at 7:30am if they are off, so that might actually be the best way to do it. I certainly didn't think of using it that way.
I was thinking that I could schedule a reboot between 2:30 and 3:00am (our library closes at 2:00am) then have the machine available for policies and updates until open at 7:30am.
But I guess if I shut it down around 2:30am, then maybe bring the machines up around 6:00 or 6:30am, that would accomplish the same thing.
Thanks for the idea @bentoms. I think I will give this a shot.
@jrippy We wanted to let Casper decide to reboot (or not) based on whether someone was logged onto the Mac at the time. At certain times of the year students are logged on for days, and our labs never close. The launchdaemon just calls the policy at 5am, and voila! -- everything's fresh the next morning. Unless, of course, a student left their session idle or is working all night. Usually they've got a large rendering project running. It seems a different scenario than your library, which closes nightly.
We're also using energy saver config profiles to wake/boot at 1am once a week. That works fine for what it is, but not a nightly reboot, which is what we were trying to achieve.
Is there anyway either of you could share those launchdaemon's? Would love to use something like this, but I'm just a padawan in training and would probably end up programing the power to the city to switch off every night.
@jgwatson here's my launchdaemon:
<?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>whatever.name.dmcreboot</string>
<key>ProgramArguments</key>
<array>
<string>/usr/local/jamf/bin/jamf</string>
<string>policy</string>
<string>-trigger</string>
<string>dmcreboot</string>
</array>
<key>StartCalendarInterval</key>
<dict>
<key>Hour</key>
<integer>5</integer>
<key>Minute</key>
<integer>0</integer>
</dict>
<key>ServiceDescription</key>
<string>DMC Daily Reboot</string>
</dict>
</plist>
In my JSS policy, I use the custom trigger with custom name 'dmcreboot', frequency=ongoing. Mine is scoped to static groups of lab machines, and it restarts a Mac immediately if no one is logged on. You can select additional items under the "Maintenance" option aside from just a straight reboot.
Some of our labs close at 10 and if I schedule anything, I set it for 11pm or 6:30am. At 1 have them shutdown and then startup at 6am before students or faculty possibly get in at 7:30. Usually it's closer to 9 but sometimes there's an early worm. To set that up I used pmset sometime back but that was before I realized that there was a configuration profile that could do the same. Last time I checked though I believe pmset gave more flexibility on setting things but I think that applied more to display sleep time and such.