Skip to content


Automatically ensure that Time Machine is disabled while playing

Time Machine is a very handy backup tool that is part of MacOSX. In general you want to make sure that it’s regularly running to protect you from losing any work. However, as with most things, this doesn’t come without a price. When Time Machine runs, your system performs a lot of disk activity and your computer is quite busy comparing and copying files. This creates noticeable performance problems when playing live music with your computer.

I’ve personally been trying to remember to turn Time Machine off each time I want to play with my Eigenharp or my guitar, but I often forget … and even worse, I very often forget to turn it back on afterwards. So, since I’m lazy, I came up with a solution to make this happen automatically.

The first step is to create a user account on you Mac that is dedicated to playing live music. This is a good idea anyway since you’ll have a much cleaner environment while performing, thus reducing the risks of hiccups. Let’s call this user “liveplaying”. To create this user, simply go to your System Preferences and press the Accounts icon. Once in there, you’ll be able to click the plus button to add a new user. Note that you might have to press the lock and provide an administrator’s name and password to be able to do this.

Once this user is created, it’s time to write a little script that will be executed each time any user logs into the computer through the login window. To do this, open a text editor, like TextEdit and make sure you’re working in plain text mode (go to the ‘Format -> Make Plain Text’ menu in TextEdit). This is the content of the script:

#!/bin/sh
if [ $1 = "liveplaying" ]
then
  defaults write /Library/Preferences/com.apple.TimeMachine "AutoBackup" -boolean false
else
  defaults write /Library/Preferences/com.apple.TimeMachine "AutoBackup" -boolean true
fi

You can copy and paste this into your TextEdit window and then save it to a shared location, for instance /Users/Shared/loginHook.sh.

What this script basically does is check what the name is of the user that is logged in and then turn on the automatic backup preference setting on or off based on that. In this case, when the “liveplaying” user is logged, the automatic backup will be disabled and for all other users it will be enabled.

Next is to allow this script to be executed and to make MacOSX aware of the fact that this script should be run at each user login. To do this, you’ll have to open the Terminal application that can be found in the /Applications/Utilities directory. This will only work if you’re using a user that has administrator privileges. You’ll be asked for your password to confirm that you do want to execute commands at this level.

This is what you should type in the terminal:

sudo chmod +x /Users/Shared/loginHook.sh
sudo defaults write com.apple.loginwindow LoginHook /Users/Shared/loginHook.sh

You can now log out of your user account and log into the ‘liveplaying’ user account. When you go to the Time Machine preference panel in the System Preferences, you’ll see that automatic backup has been turned off. When you log out of this account and back into another one, you’ll also see that it has been turned on again.

Hope this is helpful,

Geert

Posted in Live, Software, Tip.

Tagged with , , , , , .


0 Responses

Stay in touch with the conversation, subscribe to the RSS feed for comments on this post.



Some HTML is OK

or, reply to this post via trackback.