fedora-intune: take the first Defender health snapshot right after boot #7

Merged
Misthios merged 1 commits from misthios/defender-snapshot-at-boot into main 2026-10-20 14:02:44 +00:00
2 changed files with 10 additions and 1 deletions
Showing only changes of commit 49b360dffa - Show all commits

No files matched your search

@@ -24,6 +24,13 @@ FIELDS=(
app_version 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")" tmp="$(mktemp -d "${DEST}.XXXXXX")"
trap 'rm -rf "${tmp}"' EXIT trap 'rm -rf "${tmp}"' EXIT
for field in "${FIELDS[@]}"; do for field in "${FIELDS[@]}"; do
@@ -2,7 +2,9 @@
Description=Save Microsoft Defender health every 5 minutes Description=Save Microsoft Defender health every 5 minutes
[Timer] [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 OnUnitActiveSec=5min
[Install] [Install]