Created
March 2, 2012 12:51
-
-
Save rickychilcott/1958219 to your computer and use it in GitHub Desktop.
MunkiServer Data Gather
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
#Connect to server | |
REMOTE_DRIVE="/Volumes/DataRepo" | |
mkdir -p $REMOTE_DRIVE | |
/sbin/mount_afp "afp://server/MSJoiner" $REMOTE_DRIVE | |
#First Drive | |
LOCAL_DRIVE=${DS_LAST_RESTORED_VOLUME} | |
#mac address | |
MAC=`/sbin/ifconfig en0 | awk '/ether/ {print $2}'` | |
#computer name | |
COMP_NAME=`/usr/libexec/PlistBuddy -c 'Print System:Network:HostNames:LocalHostName' $LOCAL_DRIVE/Library/Preferences/SystemConfiguration/preferences.plist` | |
#Create file with with name {macaddress}.txt | |
DATA_FILE="$REMOTE_DRIVE/$MAC.txt" | |
#Write contents to file | |
echo $MAC > $DATA_FILE | |
echo $COMP_NAME >> $DATA_FILE | |
echo `ls $DRIVE/Users` >> $DATA_FILE | |
#Unmount from AFP | |
umount $REMOTE_DRIVE | |
rm -rf $REMOTE_DRIVE | |
exit 0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment