Skip to content

Instantly share code, notes, and snippets.

@nriley
Created February 13, 2010 00:36
Show Gist options
  • Save nriley/303147 to your computer and use it in GitHub Desktop.
Save nriley/303147 to your computer and use it in GitHub Desktop.
#!/bin/zsh -ef
# Stop Time Machine & AppleFileServer
export PATH=/bin:/usr/bin:/usr/sbin:/usr/libexec
setopt extendedglob
diskutil mount $(diskutil list | awk '/MaryBackup\+ A/ { print $NF }')
[[ $(id -u) == 0 ]] || { print "$0: must be running as root" >&2 ; exit 1 }
# disable AppleFileServer
if launchctl list com.apple.AppleFileServer >& /dev/null ; then
launchctl unload /System/Library/LaunchDaemons/com.apple.AppleFileServer.plist
fi
# disable backupd
defaults write /Library/Preferences/com.apple.TimeMachine AutoBackup -bool NO
# wait for backupd to stop
while launchctl list com.apple.backupd | grep -q 'com.apple.backupd-status'; do
sleep 1
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment