Skip to content

Instantly share code, notes, and snippets.

@fuzzylogiq
Last active August 29, 2015 14:23
Show Gist options
  • Save fuzzylogiq/fadbc9716275b4466086 to your computer and use it in GitHub Desktop.
Save fuzzylogiq/fadbc9716275b4466086 to your computer and use it in GitHub Desktop.
Pre & Postflights for munki to call jamf recon only if managedsoftwareupdate has installed or removed
#!/bin/bash
ORCHARD_DEFAULTS=/Library/Preferences/uk.ac.ox.it.orchard
MUNKI_DEFAULTS=/Library/Preferences/ManagedInstalls
LOG_FILE=$(defaults read "${MUNKI_DEFAULTS}" LogFile)
LOG_DIR=$(dirname "${LOG_FILE}")
INSTALL_LOG_MTIME=$(stat -f "%m" "${LOG_DIR}/Install.log")
# Only run jamf recon if an Install/Removal has taken place
if [ $(defaults read "${ORCHARD_DEFAULTS}" InstallLogMtime) -ne $INSTALL_LOG_MTIME ];then
/usr/sbin/jamf recon > /dev/null 2>&1 &
fi
#!/bin/bash
ORCHARD_DEFAULTS=/Library/Preferences/uk.ac.ox.it.orchard
MUNKI_DEFAULTS=/Library/Preferences/ManagedInstalls
LOG_FILE=$(defaults read "${MUNKI_DEFAULTS}" LogFile)
LOG_DIR=$(dirname "${LOG_FILE}")
INSTALL_LOG_MTIME=$(stat -f "%m" "${LOG_DIR}/Install.log")
defaults write "${ORCHARD_DEFAULTS}" InstallLogMtime "${INSTALL_LOG_MTIME}"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment