Stop a Time Machine backup that has already started?

I wrote a couple of scripts: one to turn TM off, and one to turn it back on. A one-click version of the on/off switch in System Preferences. However, I keep forgetting to turn TM back on when I’m done.

My solution stands as an Automator app that will turn off TM backup scheduling and leave a window up asking me to turn it back on. When I get done with whatever needed the CPU/Hard disk’s full attention, I just click resume and all is well once more.

There is just one last thing I want to automate. In case I forget to run the app before starting up whatever intensive process, I want the app to cancel any TM backup that has already started and is slowing down the system. Yes, I could use the Time Machine icon in the menu bar and click “Stop backing up,” but it can get so slow that it is a hassle to sit around and wait for the GUI to respond. I just want to click my pause app, have any current backup stopped, cancel backup scheduling, and wait for me to resume scheduling.

SO, my problem: How can I use Automator/Apple Script/Shell Scripts to stop a backup that has already started.

My searches give me plenty of ways to start scheduling, stop scheduling, modify scheduling, but so far nothing to cancel a backup in progress. If it’s out there, it’s being obscured by all the people trying to adjust scheduling, not stop a current backup task.

Here’s what I have so far, with nothing yet that will stop an active backup when the workflow runs: http://cl.ly/C4KA

I’m not sure if this is what you’re after, but for a script I’m developing I use this:


--Force Time Machine to stop
do shell script "killall backupd" user name "username" password "password" with administrator privileges

Hi,

sorry, it’s a very bad idea to kill the process because the backup could be left in a undefined state.
The menu items of Time Machine’s menu bar item are accessible by its executable followed by a number
This stops the backup in a controlled way

do shell script "/Applications/Time\ Machine.app/Contents/MacOS/Time\ Machine 3"

See all available commands in /Applications/Time Machine.app/Contents/Resources/Menu.plist

Ah, thanks very much. Yes, I was trying to avoid just killing the process and potentially ruining my backups.

…and in case anyone finds this, I’ll just add that the file path passing from AppleScript to shell script will need escaped spaces to be themselves escaped:

do shell script "/Applications/Time\\ Machine.app/Contents/MacOS/Time\\ Machine 3"

thanks… I’ve been trying to find a nicer way of doing that… I’m still new to applescript and keep finding new techniques every day

…so now I’m trying to do this same thing with a third-party menu extra called Clusters (which compresses files wherever possible to save space), but when I go into the package contents, there is no menu.plist, but there is a MainMenu.nib.

Can I still use this method? Is there something else I can do to trigger a “click” on the menu line?

As far as I know there is no built-in scripting method to pause it.

It would be simple enough to pause it myself, and then run the rest of my automated workflow, but obviously a one-click solution for all the steps is preferable.

I guess no, the menulet executable must explicitly support the direct call with parameters.
This is not the default behavior.