-
-
Save tjluoma/9719225 to your computer and use it in GitHub Desktop.
disables de-duplication in CrashPlan, which makes upload speeds much faster. Note: @thewellington did all the hard work here, I just added some to it.
This file contains 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/zsh | |
# Purpose: disable deduplication in CrashPlan | |
# | |
# From: Tj Luo.ma | |
# Mail: luomat at gmail dot com | |
# Web: http://RhymesWithDiploma.com | |
# Date: 2014-03-23 | |
# | |
# | |
# Forked from: <https://gist.github.com/thewellington/8984012> | |
# crashplanFixup.sh for Macintosh OS X 10.9 (and probably earlier versions) | |
# | |
# This script will prevent CrashPlan from de-duplicating data on files greater than 1k. | |
# Based on information from http://networkrockstar.ca/2013/09/speeding-up-crashplan-backups/ | |
# | |
# | |
# v1.1 2014-03-13 by [email protected] | |
# v1.2 2014-03-23 by [email protected] | |
# - removed `sudo` requirement except where explictly needed | |
# - added support for plist in ~/Library/LaunchAgents/ | |
# - added checks to make sure plist and FILEPATH both exist | |
# - added check to make sure we haven't already done this on $FILEPATH | |
NAME="$0:t:r" | |
# This is the path to your my.service.xml file | |
FILEPATH='/Library/Application Support/CrashPlan/conf/my.service.xml' | |
if [ ! -f "$FILEPATH" ] | |
then | |
echo "$NAME: No file found at $FILEPATH" | |
exit 1 | |
fi | |
# Check to see if we've already done this | |
fgrep -i -q '<dataDeDupAutoMaxFileSizeForWan>1</dataDeDupAutoMaxFileSizeForWan>' "$FILEPATH" | |
EXIT="$?" | |
if [ "$EXIT" = "0" ] | |
then | |
echo "$NAME: $FILEPATH has already been updated (dataDeDupAutoMaxFileSizeForWan = 1)" | |
exit 0 | |
fi | |
if [ -f '/Library/LaunchDaemons/com.crashplan.engine.plist' ] | |
then | |
PLIST='/Library/LaunchDaemons/com.crashplan.engine.plist' | |
LAUNCHCTL_SUDO='sudo' | |
elif [ -f "$HOME/Library/LaunchAgents/com.crashplan.engine.plist" ] | |
then | |
PLIST="$HOME/Library/LaunchAgents/com.crashplan.engine.plist" | |
LAUNCHCTL_SUDO='' | |
else | |
echo "$NAME: Could not find com.crashplan.engine.plist either at | |
'$HOME/Library/LaunchAgents/com.crashplan.engine.plist' | |
or | |
'/Library/LaunchDaemons/com.crashplan.engine.plist'" | |
exit 1 | |
fi | |
# Sets the <dataDeDupAutoMaxFileSizeForWan> key to 1 - to prevent all files greater than 1k from being deduplicated | |
sudo sed -i .bak 's/\(<dataDeDupAutoMaxFileSizeForWan>\)[0-9]*\(<\/dataDeDupAutoMaxFileSizeForWan>\)/\11\2/' "${FILEPATH}" | |
EXIT="$?" | |
if [ "$EXIT" != "0" ] | |
then | |
echo "$NAME: 'sed' command failed (\$EXIT = $EXIT)" | |
exit 1 | |
fi | |
# Restart CrashPlan | |
RESTART='1' | |
${LAUNCHCTL_SUDO} launchctl stop com.crashplan.engine 2>/dev/null | |
${LAUNCHCTL_SUDO} launchctl unload "$PLIST" 2>/dev/null | |
${LAUNCHCTL_SUDO} launchctl load "$PLIST" && \ | |
${LAUNCHCTL_SUDO} launchctl start com.crashplan.engine && \ | |
RESTART=0 | |
if [ "$RESTART" = "0" ] | |
then | |
echo "$NAME: Successfully restarted com.crashplan.engine via launchctl" | |
else | |
echo "$NAME: FAILED to restart com.crashplan.engine via launchctl" | |
exit 1 | |
fi | |
# Launch CrashPlan Menu Bar Extra - Comment out the next line if this is undesired behavior | |
open -g "/Applications/CrashPlan.app/Contents/Resources/CrashPlan menu bar.app" | |
exit | |
# | |
#EOF |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
great additions... The one thing I would caution you about here is that if you have multiple backup sets, the will show up once for each backup set in the my.service.xml file. You check looks for a single instance of that and if it is there, exits. It is possible that the first set would have a value of 1 while subsequent sets have a different value. This would lead to exiting the script before changing those other sets... and you would only have turned de-duplication off on the first set.