Okay, so we are getting ready for our 10.6 migration to 10.8 and with it we are doing a fresh install. Below is a rsync script I've been working on, but it seems to ignore the "--excludes" every time???
Any ideas?
#!/bin/bash
#########################################################################################################
# This script replicates files from the current logged in users home directory #
# to USMFS008 for temporary storage. #
# #
# This script was made as part of the 10.8 Upgrade Project & JAMF Implementation. #
# #
# Users can restore their data from Self Service by click on Restore User Data. #
# This will be a one-time restore and files will be deleted from USMFS008 once restore is complete. #
# See UserData_Restore.sh script #
# #
# The following is excluded in the backup: #
# - Downloads Folder #
# - Library Folder (except Safari, Chrome, Firefox and Stickies) #
# - iTunes #
# - Microsoft User Data #
# - Trash #
#########################################################################################################
# File Name: UserData_Backup.sh
# Created By: Joshua Roskos
# Created On: Thursday, January 9th, 2014
# Modified On: Thursday, January 9th, 2014
# Determine Current Logged-In User
lastUser=`defaults read /Library/Preferences/com.apple.loginwindow lastUserName`
echo "$lastUser"
# Mounts USMFS008 UserData Folder
sudo mkdir /Volumes/UserData
sudo mount_afp afp://user:pass@usmfs008/UserData /Volumes/UserData
# Create Log File
# sudo touch /Volumes/UserData/_Logs/"$lastUser.log"
# sudo chmod 777 /Volumes/UserData/_Logs/"$lastUser.log"
# sudo echo " " >> /Volumes/UserData/_Logs/"$lastUser.log"
# sudo echo "=====Starting rSync of $lastUser @ $(date)=====" >> /Volumes/UserData/_Logs/"$lastUser.log"
# Backup Users Home Directory
sudo mkdir /Volumes/UserData/"$lastUser"
sudo rsync -avzrpog --update --delete --include=Library/Safari/** --include=Library/StickiesDatabase --include=Library/Applications Support/Firefox/** --include=Library/Application Support/Google/** --exclude=./Trash/** --exclude=/Music/iTunes/** --exclude=/Documents/Microsoft User Data/** --exclude=/Library/** --exclude=/Downloads/** --progress --log-file="/Volumes/UserData/_Logs/$lastUser.log" /Users/"$lastUser"/ /Volumes/UserData/"$lastUser"/
sudo umount /Volumes/UserData
exit 0