Skip to main content
Question

System restart notification via Swift Dialog


Forum|alt.badge.img+9

Another script that grew out of necessity.  Trying to "encourage" users to restart their Macs at least once every 30 days to help with overall system performance, make sure all policies are installed, fix network related issues, etc. so I can with with this super simple Dialog notification that shows up once a week if they are in the "over 30 day uptime" smartgroup.  Users don't have to restart, but if they do, you can set a custom timer to do an automatic restart for them.  I used the AppleScript method of doing a restart so it will prompt the user to save their docs before a restart.  Script can be found here: https://github.com/ScottEKendall/JAMF-Pro-Scripts/tree/main/UpTime

Regex I used to calculate 30+ days

And the script parameters...you can control the uptime days and timer value.

2 replies

sdagley
Forum|alt.badge.img+25
  • Jamf Heroes
  • 3540 replies
  • May 5, 2025

@ScottEKendall Thanks for sharing. One suggestion though... Instead of having an EA that converts the result of uptime into a number of days, use one that returns the date the Mac was last booted so Jamf Pro can use date logic for it as a Smart Group criteria (since the number of days won't be accurate if the Mac isn't reporting inventory in). This thread is where I found the EA I use for that: https://community.jamf.com/t5/jamf-pro/restart-computer-after-x-days-of-uptime/m-p/262581


Forum|alt.badge.img+9
  • Author
  • Valued Contributor
  • 59 replies
  • May 5, 2025

Excellent suggestion...thanks!


Reply


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings