Skip to content

Instantly share code, notes, and snippets.

@calum-github
Created June 22, 2015 02:00
Show Gist options
  • Save calum-github/fb46086c2dc89debe85a to your computer and use it in GitHub Desktop.
Save calum-github/fb46086c2dc89debe85a to your computer and use it in GitHub Desktop.
Site Info script
#!/bin/bash
#####################################################################
# #
# Author: Calum Hunter #
# Date: 17-10-2014 #
# Version 0.1 #
# Purpose: Script to capture the site #
# and send this to our Munki Report server #
# #
#####################################################################
# Skip manual check
#if [ "$1" = 'manualcheck' ]; then
# echo 'Manual check: skipping'
# exit 0
#fi
# Create cache dir if it does not exit
DIR=$(dirname $0)
mkdir -p "$DIR/cache"
# Location of our output cache file
site_info_file="/usr/local/munki/preflight.d/cache/site_info.txt"
# Get the site info out of our ARD Text field
site_name=`defaults read /Library/Preferences/com.apple.RemoteDesktop.plist Text1 | awk -F ": " '/Site/ {print $3}' | cut -d "," -f1`
# Write the results into our cache file
echo "Site_Name = $site_name" > $site_info_file
exit 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment