Automating Backblaze?

Hello, everybody! I had this idea of running a Keyboard Maestro macro to quit (or pause) Backblaze when I connect to my home network (as Backblaze will crush my feeble ADSL2 upload speeds).

However, I couldn’t find if Backblaze has a command-line tool. Anybody know if there is one and how to access it?


The tool you are looking for is /Library/Backblaze.bzpkg/bztransmit and if you run it without any arguments to see all of its options.


These three commands can be used to stop Backblaze:

sudo launchctl stop com.backblaze.bzbmenu
sudo launchctl unload /Library/LaunchDaemons/com.backblaze.bzserv.plist 
/Library/Backblaze.bzpkg/bztransmit -pausebackup

The first two are basically doing the same thing - telling launchd to stop the process. That will stop Backblaze until you start it again (see below) or reboot.

The third one will pause Backblaze for some period of time, I think 4 hours.


These two commands will re-enable Backblaze if you have used the opposite commands shown above:

sudo launchctl stop com.backblaze.bzbmenu
sudo launchctl load /Library/LaunchDaemons/com.backblaze.bzserv.plist 

This one is suppose to “start” a backup.

/Library/Backblaze.bzpkg/bztransmit -completesync 

The most reliable way to stop Backblaze is the launchd way but if you want to automate it you may need to add the commands to sudoers file.

Hope that helps. Let me know if you have more questions.

1 Like

TJ - you’re a superstar! Thank you!

I ran against my 1T data limit this month and installed TripMode to block internet access for certain apps like Backblaze and Dropbox while I’m at home. It can change configuration based on the adapter/network you’re connected with.

1 Like

Yeah I was gonna say, just use TripMode.

Glad to help. Now that I’m back at my Mac, I can add that the commands I have added to sudoers are these two lines.

%admin ALL=NOPASSWD: /bin/launchctl load /Library/LaunchDaemons/com.backblaze.bzserv.plist

%admin ALL=NOPASSWD: /bin/launchctl unload /Library/LaunchDaemons/com.backblaze.bzserv.plist

which will allow you to do

sudo /bin/launchctl unload /Library/LaunchDaemons/com.backblaze.bzserv.plist


sudo /bin/launchctl load /Library/LaunchDaemons/com.backblaze.bzserv.plist

without having to enter your password.

How to use a sudoers file

If you aren’t familiar with the sudoers file, BE CAREFUL. It’s dangerous. If you muck up the /etc/sudoers file, it can be hard to undo.

Following best practices, I do not edit the main /etc/sudoers file itself, but I have a separate file at /etc/sudoers.d/tjluoma instead.

You can name your file whatever you want (I’ll use “whatever” as a placeholder) , but it has to be owned by root:wheel and it has to be chmod 440. I also think the name has to be all lowercase with no extension (i.e “.txt”).

sudo touch /etc/sudoers.d/whatever
sudo chown root:wheel /etc/sudoers.d/whatever
sudo chmod 440 /etc/sudoers.d/whatever

once you have the file in place, you want to edit it using the visudo command, such as:

EDITOR=nano sudo visudo -f /etc/sudoers.d/whatever

Because visudo will syntax-check the file for you.

n.b: Unless you know that your $EDITOR is set, you’ll want to use EDITOR=nano otherwise you’ll end up having to use vi which is basically a torture device masquerading as a unix program; despite this, some zealots will tell you that you should learn to use vi because some day the world might explode and vi might be your only option. Learn to ignore those people.

You can check the syntax of your sudoers file (and make sure it’s being checked) by running:

sudo visudo -c

which will show you all of the files that it sees, and will tell you if they are OK or not. Here’s what it looks like on my system:

% sudo visudo -c
/etc/sudoers: parsed OK
/private/etc/sudoers.d/503: parsed OK
/private/etc/sudoers.d/tjluoma: parsed OK
/private/etc/sudoers.d/traceyluoma: parsed OK

I hope this helps. Adding things to the sudoers file is definitely a “power user” move, but, hey, that’s why we’re here, right ;-?

1 Like