mannconsulting / Jamf-Client-Communications-Doctor

Daemon that sets a TTL on Jamf Policies and EAs to ensure clients communicate with Jamf
https://mann.com/jamf/doctor
12 stars 3 forks source link

Fix cleanup loop #1

Closed sgmills closed 5 months ago

sgmills commented 5 months ago

A line similar to Jamf Client Communications Doctor.sh:384: bad math expression: operator expected at 02:35:41 shows up in our logs several times.

Line 384 reads: if [[ $days -ge 2 ]]; then

I believe the $days variable is spitting out something in the format of 02:35:41 when it is expecting an integer for the number of days.

The $i variable on line 379 appears to be an orphan and and I think that is causing problems. Replacing it with ${jamfPid} as it is on line 376 seems to resolve the bug. We have tested this change and appearances of "bad math expression" in the logs stopped. After this change we observed this in the logs:

JamfClientCommunicationsDoctor : 20230829 : 0-27589 : Jamf Policy running for more than 2 days, killing and refreshing LaunchDaemon
isaacatmann commented 5 months ago

@sgmills Added another commit to make the $days variable unique vs. when it's used in the hung installer checks.