Looking to figure out a way to see how many laptops have not restarted or shutdown in awhile.
Running into teachers that just do not shut down at all or restart.
Thanks
Looking to figure out a way to see how many laptops have not restarted or shutdown in awhile.
Running into teachers that just do not shut down at all or restart.
Thanks
Can't recall where we got this, but here's an Extension Attribute to see how many days, hours, and minutes a Mac has been up.
#! /bin/sh
# if $4 from `uptime` is "mins," then the system has been up for less than an hour.
# We set $timeup to the output of $3, appending only "m".
timechk=`uptime | awk '{ print $4 }'`
if [ $timechk = "mins," ]; then
timeup=`uptime | awk '{ print $3 "m" }'`
# if $4 is "days," then we generate a readable string from $3, $4, and $5;
elif [ $timechk = "days," ]; then
timeup=`uptime | awk '{ print $3 $4 " " $5 }' | sed 's/days,/d/g' | sed 's/:/h /g' | sed 's/,/m/g'`
# otherwise, generate a readable string from $3.
else
timeup=`uptime | awk '{ print $3 }' | sed 's/:/h /g' | sed 's/,/m/g'`
fi
echo "<result>$timeup</result>"
I have an EA that checks for uptime
#!/bin/bash
echo "<result>$(date -jf "%s" "$(sysctl kern.boottime | awk -F'[= |,]' '{print $6}')" +"%Y-%m-%d %T")</result>"
and if you set your EA Data Type to "Date" you can query it through a smart group. After that you can create policies to reboot them, or nag them to reboot, at least. I use a Jamf Helper pop up window with option to "esc" close removed, then their choices are "Reboot Now" or "Reboot Later" with a drop down picking a forced reboot countdown.
repp
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.