Skip to main content

I am trying to find a way to create a policy that will restart a computer after it's been up for X number of days. I don't want it to force a reboot instantly though. I want the user to have the option to postpone it 2 or 3 times until it forces. Has anyone had any luck with this? 

Sure! Here's mine:

#!/bin/sh

uptime=$( uptime )
dayCount=$( uptime | awk -F "(up | days)" '{ print $2 }' | sed 's/[ day].*//' )

if [[ $uptime == *"day"* ]]; then
echo "<result>$dayCount</result>"

else echo "<result>0</result>"

fi

exit 0

 


Good Morning John

I meant this policy for this

All the policy does is leverage the User Interaction tab to display the following message as a notification:

"Your Mac hasn't been restarted in more than 21 days. Restarting your Mac at least once a week helps keep it running optimally. - IT"


Looks exactly like mine, and my policy and smart groups.

 


Good Morning John

I meant this policy for this

All the policy does is leverage the User Interaction tab to display the following message as a notification:

"Your Mac hasn't been restarted in more than 21 days. Restarting your Mac at least once a week helps keep it running optimally. - IT"


Have you checked out Renew? https://github.com/SecondSonConsulting/Renew


Good Morning John

I meant this policy for this

All the policy does is leverage the User Interaction tab to display the following message as a notification:

"Your Mac hasn't been restarted in more than 21 days. Restarting your Mac at least once a week helps keep it running optimally. - IT"



The biggest issue is that users now move the popup window to the edge of the screen to ignore it and therefore the script / policy will never be fully executed.



Sorry for the necro but do you add anything else to the policy other than the General tab? EA is pulling the correct information, smartgroup is made properly and policy is scoped to the SG but not seeing any notifications. Wondering if self-service/LDAP sync needs to be enabled for users to see the notification? 


Sorry for the necro but do you add anything else to the policy other than the General tab? EA is pulling the correct information, smartgroup is made properly and policy is scoped to the SG but not seeing any notifications. Wondering if self-service/LDAP sync needs to be enabled for users to see the notification? 


I’m glad you brought that up. I think something in Jamf has become broken with regard to notification messages. I’m going to go submit a ticket right now actually.


I’m glad you brought that up. I think something in Jamf has become broken with regard to notification messages. I’m going to go submit a ticket right now actually.


Ahh. We are brand new to Jamf, just starting the migration process so just wanted to dig a bit deeper. Let me know what you find out!


Ahh. We are brand new to Jamf, just starting the migration process so just wanted to dig a bit deeper. Let me know what you find out!


Will do!


Reply