Posted on 03-08-2016 06:21 AM
Best way to setup auto-restart on a nightly or certain day basis. I want to do it without installing a package to force the restart
Posted on 03-08-2016 06:27 AM
You could create a policy that just runs the command "sudo shutdown -r now" and tell it to run daily and set the operating hour on the client side limitations. Although Capser might have issues with this since it might not register that the policy actually ran.
Another options is to use the reboot function in the policy and tell it to reboot immedialtly. This way at least the policy will register as finished before it reboots.
Posted on 03-08-2016 06:32 AM
You can use pmset
to schedule a restart. I have a post showing how to do that available via the link below:
https://derflounder.wordpress.com/2016/02/29/using-pmset-on-os-x-to-schedule-restarting-your-mac/
Posted on 03-08-2016 06:42 AM
Although it should be worth noting that if you have any type of full disk encryption like FileVault, you might not be able to reboot autonomasly without using something like the authenticated restart feature. So be mindful of that.
Posted on 03-09-2016 05:12 AM
You can also use a configuration profile to turn devices off & on.
Posted on 08-24-2023 10:43 AM
there is no "Energy Saver" payload for config profiles in Jamf Pro. Nor do I see any other payload that could facilitate a reboot
Posted on 03-09-2016 08:07 AM
I also use a configuration profile to turn my machines on in a lab, then shut them down in the evening.
Posted on 03-09-2016 08:16 AM
Using a config profile or pmset
to start/shutdown a machine works great, if the user did not leave a document open that needs saving. The only way (that I know of) to get around that is to force the shutdown as @roiegat mentioned.
For a restart:
shutdown -r now
Or for a shutdown:
shutdown -h now
Simply placing that in the Execute Command box of a policy and then setting the policy to execute on whatever schedule you want, should restart the machine.
I use a LaunchDaemon with a local script (issuing the same command) to do this on our lobby computer. That way I can schedule with some accuracy when the shutdown will happen.
Posted on 03-09-2016 10:07 AM
I would personally steer away from the shutdown -r/h options. You don't get reporting that it completed or failed, that is unless you have an extension attribute that checks the last restart date & time and a policy set to run at startup which updates inventory.
If you're running 9.82 (and I think 9.81 too?) just create a policy with only the Restart payload enabled. Set your timeframe which to run on your clients and the frequency you want it to run.
This way it's reported and you can choose a timeframe when the computers are available to restart.
Posted on 03-09-2016 10:10 AM
@jduvalmtb 's method will forcibly shutdown if a user is logged in and using the computer. The method above allows you to set options for if someone is logged in or not.
Posted on 01-30-2019 12:05 PM
@aporlebeke What I don't understand is how to use the policy method to reboot the machines nightly. If I create a policy with only the restart payload configured, as pictured above, how do I configure the Trigger and the Frequency to have a nightly reboot as say, 2:00 AM?
Posted on 01-30-2019 12:34 PM
@Morningside So the smart group I have configured is what pops the lab machines into the policy scope based on an extension attribute which reads the date & time of the last reboot. I have this set to more than 6 days ago to achieve the desired weekly result.
The policy itself, which is set to trigger once a week, I have client-side limitations setup such that it only runs on the day I want and between the hours I want, in this case Friday mornings between 1 & 5:59 am (this after our Jamf Pro server completes its daily database backup). So even if lab machines are in the group, the policy doesn't run until the desired day & timeframe.
With the once a week trigger, this avoids the policy from running again, as we don't have the machines update inventory on startup in order to collect the new last reboot date.
Hope that makes sense.
Posted on 01-31-2019 09:36 AM
@aporlebeke Thanks for that! I have set mine up for my lab iMacs as shown above and could not be happier. I appreciate the help!
Posted on 01-14-2021 12:55 PM
I've dug around and can't figure out how you got that custom operator, "more than x days ago".
Got any tips?
Were on Jamf v.10.25.
TIA!!!
Posted on 01-14-2021 12:58 PM
@geebee your EA has to be configured as a 'Date'
Posted on 01-15-2021 01:56 AM
Hello,
Trying to use the script referenced here have created a Extension Attribute as shown in the image below, and have the policy setup as shown in the second image the policy runs successfully but never puts the key into the computer extension attribute record
Thanks for your help in advance
Posted on 01-15-2021 10:29 AM
@JAMFInfra You have a policy running a script, which isn't correct. You need to put the script for returning last boot time in the EA itself by changing the input type from "Text Field" to "Script".
Posted on 01-15-2021 10:31 AM
There's nothing inherent about running a script as part of policy that will return data to an extension attribute
Posted on 01-19-2021 01:24 AM
Thanks so much the EA is working now!