Automating MAU Caching Server with Slack Notifications

SlackIn the past I have always run MAUCacheAdmin manually. Microsoft Office updates are usually only released once per month so it is easy to know when another run is needed. Plus with no built-in way to move collateral files into the appropriate place automated downloads won’t automatically make updates available for clients.

However with more and more applications becoming Microsoft AutoUpdate (MAU) aware, and out-of-bound patches being released, I decided it was time to automate the checks and downloads to my MAU Caching Server. This is easy enough to accomplish with a LaunchDaemon but I still needed a way to be notified when MAUCacheAdmin found updated packages to download so that I could move the collateral files into place.

I decided to see if I could add Slack notifications and when I began to dig in was pleasantly surprised to see that Microsoft’s Paul Bowden had already coded HipChat notifications. Using that as a base it turned out to be much simpler than I expected to get it working with Slack. Read on for the details.

There are only a few sections of code we need to add into MAUCacheAdmin, which at heart is just a bash script.

First we need to setup the global variables:

# Variables for Slack Notifications

Enable the notifications, enter your complete Slack Webhook URL and optionally change the icon used for the notifications. This is the only section you need to modify.

Next the code that triggers the notification:

SlackNotify () {
# Send Alert to Slack Webhook in Global Variable when Package is Downloaded
	if [ $SLACK_NOTIFY == true ]; then
		echo "New Package Detected: $PACKAGE"
		curl -X POST -H 'Content-type: application/json' --data '{"username":"MAUCacheAdmin","icon_url":"'"$SLACK_ICON_URL"'","text":"New Package Downloaded: '"$PACKAGE"'"}' $SLACK_WEBHOOK_URL

Finally we add SlackNotify to be executed when a package is downloaded:


I submitted a pull request with the additions and they got merged on Monday. So if you’d like to use Slack notifications just grab the latest code from Github and you’ll be all set!

There are definitely some improvements that could be made. For example this will send every package as a separate Slack message as they are detected whereas logging them and then sending a single list when all downloads complete, like how AutoPkgr does it, might be more desirable. I’d also like to look at automating the copying of collateral files at some point in the future. But for now I’m happy with this as a good start.

I’ll include an example LaunchDaemon below in case it might be helpful for anyone. Just edit the identifier and paths for both MAUCacheAdmin and your cache before loading it.

This example runs MAUCacheAdmin every 12 hours:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "">
<plist version="1.0">
		<string>/usr/local/MAUCacheAdmin/MAUCacheAdmin --CachePath:/Volumes/Storage/MAU/cache</string>


UPDATE 6/25/19: I added basic Microsoft Teams notification support to MAUCacheAdmin. Grab version 2.6 of the script if you’d like to use it.

Leave a Reply

Your email address will not be published. Required fields are marked *