Hi All,
I'm trying to use this script to determine if a Mac's uptime is 5 days or longer, then output results as "Yes" if so, and "No" if not. But when configured as an EA, it only gives the "No" result. What am I missing?
#!/bin/bash
# Get the system uptime in seconds
uptime_seconds=$(awk '{print $1}' /proc/uptime)
# Calculate the uptime in days
uptime_days=$(echo "$uptime_seconds/86400" | bc)
# Check if the uptime is greater than or equal to 5 days
if [ $uptime_days -ge 5 ]; then
result="Yes"
else
result="No"
fi
# Output the result in the correct format for Jamf Pro
echo "<result>$result</result>"