Hi,
The below script measures uptime in days.
The result of the script looks like this in Jamf (for a Mac that been up between 5 and 6 days)
Script result: <result>5</result>
I need to amend the script so if the Script Result is more than 21 it triggers a jamf policy using events
(jamf policy -event eventname).
but I don't know how to write that script. Any help would be appreciated. Thanks.
#!/bin/sh
dayCount=$( uptime | awk -F "(up | days)" '{ print $2 }' )
if ! [ "$dayCount" -eq "$dayCount" ] 2> /dev/null ; then
dayCount="0"
fi
echo "<result>$dayCount</result>"
exit 0