Skip to content
This repository has been archived by the owner on Mar 1, 2018. It is now read-only.

Munkiserver preflight and postflight

Ricky Chilcott edited this page Oct 4, 2013 · 5 revisions

While not required to use Munkiserver, we have included both a preflight and postflight script to be installed on your munki clients. These scrips primarily set the correct ClientIdentifier, per machine, and post various log and system profile files back to munkiserver after a munki run. You can find these files at scripts/munki_scripts/ or view on Github

We've also included a few extra features that may expand the functionality of munkiserver over time, notes below.

BlockUpdate Preflight

For some labs, you may not desire machines to apply updates during the day. While it would be possible to modify the munki launchd tasks, it can be quite confusing and tedious. There is now some functionality in the preflight script which will optionally block updates from a specific time. This functionality is totally optional, and admins have to 'opt in' to this feature. To opt in, will need to set values in /Library/Preferences/ManagedInstalls.plist under the key names BlockUpdateStartTime and BlockUpdateEndTime and BlockUpdateDays

  • BlockUpdateStartTime - Start time of block update in 24 time, (e.g. "08:00")
  • BlockUpdateEndTime - End time of block update in 24 time, (e.g. "18:00")
  • BlockUpdateDays - set to days the block should take effect, defaults to all days. You can NOT set the value or set it to "All". If you would only like a specific set of days, define# define the value in a string like "0, 3, 5" to only block on Mon, Wed, Fri. 0 is Monday, 6 is Sunday

This preflight will only block updates when munki is called in auto mode (which typically only occurs at the loginwindow). Manual checks via an admin or user will still go through.

Example

Block Updates from 8 AM to 6 pm on Saturday and Sunday

/Library/Preferences/ManagedInstalls.plist

<key>BlockUpdateStartTime</key>
<string>8:00</string>
<key>BlockUpdateEndTime</key>
<string>18:00</string>
<key>BlockUpdateDays</key>
<string>5,6</string>

Postflight timeout

I've seen some issues where Munkiserver is under heavy load, can't cope, and will have client's postflight scripts 'process' for approximately 5 minutes. There is now a 90 second default to timeout in the postflight script on Line #36 of the postflight. You can optionally change this value by writing a value in /Library/Preferences/ManagedInstalls.plist PostflightTimeout.

Example

/Library/Preferences/ManagedInstalls.plist

<key>PostflightTimeout</key>
<string>120</string>