Pause ArqBackup when you wake up your Mac

After having tried all almost-free cloud-based (Bitcasa, Mozy, etc…) backup solutions, I tried Arq, and since August 2012, I use it without problems.

I backup 120G and it costs me $11 per month for the Amazon S3 storage. Not bad. Arq can also backup to Amazon Glacier, for a fraction of this cost.

And Arq backups are encrypted with your own password. Take that, Skynet!

My problem is that I’ve setup Arq to backup every hour, and when I wake my Mac, Arq starts a backup.

When you wake up your Mac, it restarts everything like TimeMachine, other services running, it may even start indexing your disk, just for fun.

So every time, I had to manually pause Arq for 10 minutes so my Mac doesn’t suffer under the load.

When I saw that with the latest Arq version (3.1) there’s a possibility to control Arq via the command line, I automated this “pause-Arq-for-10-minutes-when-waking-up”.

For this, you’ll need SleepWatcher, a tool by Bernhard Baehr that allows you to run a script when your Mac wakes up or goes to sleep. We’re only interested in the wake up feature.

Start by installing SleepWatcher with HomeBrew.


brew install sleepwatcher

copy the launchd configuration file:


cp /usr/local/Cellar/sleepwatcher/2.2/de.bernhard-baehr.sleepwatcher-20compatibility-localuser.plist ~/Library/LaunchAgents

Now we need to put some commands to run when the Mac wakes up in a file named “.wakeup” in your home dir.


vim ~/.wakeup

My wakeup file contains:


#!/bin/sh

/Applications/Arq.app/Contents/MacOS/Arq pause 10

echo "Arq paused"

make the .wakeup file executable


chmod a+x ~/.wakeup

Load the launched config file:


launchctl load ~/Library/LaunchAgents/de.bernhard-baehr.sleepwatcher-20compatibility-localuser.plist

Voila, you’re done.

Put your Mac to sleep, and wake him.

The Arq menubar icon should show the pause icon: Screen Shot 2013-03-05 at 12.50.17

Happy?

Leave a Reply

Your email address will not be published. Required fields are marked *

*