Run Carbon Copy Cloner Task

There's a way to do this mentioned here:

But I would like to create a more complex macro that checks which drives are present but not mounted and then run the task related to that drive.

I noticed that when I right click a task I get this link when I choose the Copy Link to Task option:

image

com.bombich.ccc6.task.open://0C70107A-09CF-43A7-9775-5E269C9E24D1

It seems that the long "code" at the end is the same type of code when I copy the UUID of a KM macro. Using AppleScript, I can run a KM macro by using this:

tell application "Keyboard Maestro Engine"
	do script "C0A02743-D829-4D2A-83CC-5C0547FBD665"
end tell

I tried the same with CCC, but no luck:

tell application "Carbon Copy Cloner"
	do script "0C70107A-09CF-43A7-9775-5E269C9E24D1"
end tell

Maybe there's a similar "Engine" for the CCC, but I can't seem to find it.

Anyone familiar with CCC that can help me with this?

The “code” is a UUID - a universally unique identifier and in the case of CCC it just uniquely identifies a particular CCC task.

So the link you’ve copied is actually an x-callback URL and you use it like you would an ordinary url but it doesn’t point to a web address in this case but a CCC task.

Since I’m not at my Mac I can’t create an example for you to use but instead look at this discussion to see an example of how to use it:

There may be other examples in the forum - just search for callback.

2 Likes

Thanks for sharing that thread. Unfortunately, I can't really understand what you guys are discussing there, as my knowledge is not at that level yet...

My question is: if that x-callback url contains a UUID as well (or so it seems), can't I use it (just the UUID portion, of course) the same way as I use the UUID to trigger a KM macro using AppleScript?

Hope it makes sense.

There’s no if about it - as I said, it does.

Nope - but this is what you must do…

Sorry I can’t spoon feed you a solution since I’m not at my Mac so try this.

Create a macro with an Open URL action in it - a bit like this one:

image

Now paste the link you got from CCC into the Open URL field in the action and then change the with drop-down to Carbon Copy Cloner or CCC (whichever shows in the drop-down list).

Now run the macro and it should run the CCC task whose link you copied originally.

1 Like

Ouch...!

The issue with this, is that the link doesn't actually run the task, it just opens CCC and selects the task. After that I still need to go to "Run Now". That's why I was asking if I was able to run the task via AppleScript the same way I can do it with KM and the UUID of a macro.

I can still create a macro with those steps, but if I was able to start it without CCC being activated first, and just run the macro in the background, even better.

Thank you anyway!

Just one last suggestion for you to try.

The link you copied was this:

com.bombich.ccc6.task.open://0C70107A-09CF-43A7-9775-5E269C9E24D1

Try editing it so that open is run instead, like this:

com.bombich.ccc6.task.run://0C70107A-09CF-43A7-9775-5E269C9E24D1

and try that in the little test macro you created.

1 Like

I've just had a look at the CCC help website and there is a command line tool that lets you run tasks (and do other stuff) from a shell script. The page can be found here: Using the ccc Command Line Tool to Start, Stop, and Monitor CCC Backup Tasks | Carbon Copy Cloner | Bombich Software

It would appear that if you put this line in an Execute Shell Script action:

ccc -s"Task Name"

It would start the task called "Task Name". You'll notice that it needs the name of the task rather than its UUID, so this might be easier for you to use.

1 Like

Just a quick update to my last post.

In the execute a shell script action you'll need to specify the full path to the ccc command line tool.

On my Mac (I'm there now!), the path is this:

"/Applications/Carbon Copy Cloner.app/Contents/MacOS/ccc"

so in the shell script action you would need to have this:

image

The task I'm running there is called

Clone External SSD to Internal HDD

Hopefully you can use this information to achieve what you want.

Here's copy of the above action:
Execute a Shell Script.kmactions (826 Bytes)

2 Likes

Awesome! Worked like a charm! Thank you so much!

I was looking at the link you shared and it seems that there's really no option to use the UUID, right? I'm asking, because if by any chance I need to rename the task, then using the UUID would still make the task run.

If not, no worries. This works as expected. Really appreciate it :slight_smile:

I couldn’t find any documentation on the Bombich site about using the x-callback url so for the time being you’ll have to rely on using the ccc utility. But at least you’ve got a way forward!

1 Like

Yeah it's great the way it is now. Thank you again!

1 Like

It looks from the man page that you can print a list of task names and UUIDs with ccc -u.

That suggests that, if you know the UUID, you could search the output of ccc -u and extract the corresponding task name, then use that task name in the command to start/stop tasks.

I don't have CCC so can't test anything, but if you post the (suitably redacted) output from running ccc -u in Terminal someone should be able to suggest something.

But probably the best answer is -- don't rename your tasks!

1 Like