diff --git a/images/fedora-intune/files/mdatp-health-snapshot b/images/fedora-intune/files/mdatp-health-snapshot index acdf0d7..c7cf1d7 100644 --- a/images/fedora-intune/files/mdatp-health-snapshot +++ b/images/fedora-intune/files/mdatp-health-snapshot @@ -24,6 +24,13 @@ FIELDS=( app_version ) +# Right after boot the daemon may not answer yet; give it up to 2 minutes so +# the first snapshot isn't a false "not running". +for _ in $(seq 1 24); do + [[ "$("${MDATP}" health --field healthy 2>/dev/null | tail -n1)" =~ ^(true|false)$ ]] && break + sleep 5 +done + tmp="$(mktemp -d "${DEST}.XXXXXX")" trap 'rm -rf "${tmp}"' EXIT for field in "${FIELDS[@]}"; do diff --git a/images/fedora-intune/files/mdatp-health-snapshot.timer b/images/fedora-intune/files/mdatp-health-snapshot.timer index 0d934e1..4e41c50 100644 --- a/images/fedora-intune/files/mdatp-health-snapshot.timer +++ b/images/fedora-intune/files/mdatp-health-snapshot.timer @@ -2,7 +2,9 @@ Description=Save Microsoft Defender health every 5 minutes [Timer] -OnBootSec=2min +# Early, so the compliance check at the first sign-in after boot finds a +# snapshot; Himmelblau doesn't check again for 8 hours. +OnBootSec=20s OnUnitActiveSec=5min [Install]