Pause while connected to mobile hotspot

Restic has been fantastic for backing up my MacBook: it’s super reliable, fast, and uses minimal resources. So, first of all, THANK YOU to all the developer for your hard work to creating such a great tool.

One of the issues I’ve experienced is when I go outside with my laptop and connect to the internet using my mobile data personal hotspot, if restic is running it can quickly consume all my mobile data in a few minutes, leaving me stuck and offline.

I have partially solved this problem by creating a wrapper for restic that checks if I’m connected to mobile hotspot before beginning any operation, and if so, it won’t start any new back up, prune, check, etc. However, one thing I can’t solve through this method is pausing an operation that has already begun before I leave my house. E.g., today, restic check was running when I closed my laptop and left the house; when I connected to mobile hotspot the check operation continued and used the remaining 12GB of data in my mobile plan in a few minutes (which costs about 500 pesos here, ≈ €26).

Testing if a macOS computer is using a mobile hotspot is fairly simple: just test if any network interface has been assigned a IP address. You can see how my shell script does this test here. I understand that this is not a cross-platform solution, but perhaps somebody has some ideas for making it work and useful for other platforms too? This is a common feature for consumer-grade back up software, so it’s not unreasonable that restic should include it too.

I know I can solve this in other ways, e.g., by using a firewall to block some network connections depending on which interface is in use. Little Snitch can do this well, and I used it for many years, but it just had too much cognitive overhead and I’m happier not to be using it. If there were a simple CLI technique that achieves the same it would be a good option, especially if I could integrate it into my wrapper script, although I have some hesitation towards modifying the system, because it adds one more task when doing a system reinstall.

1 Like

This is not an answer you’re looking for, but personally I wouldn’t bother running check automatically, I just run it manually when I know there’s time to do so. Same with prune.

You could create a script that does the following:

  1. Check if Restic is running
  2. Check if on Mobile
  3. send SIGSTOP to restic
  4. If not on mobile anymore send SIGCONT

This tells the OS, that it should pause the process and then continue it.


That’s probably true, it doesn’t need to be run so often. I have it schedule to run every week and use the option --read-data-subset="$(date +%V)/52" so that it will verify 100% of the data every year, on average.

However, computers should do the work for us, not the other way around; so I’m still looking for an automated way to solve this.

1 Like

This is a clever and reasonable solution; I can add this to restickler, but it would still be nice to have this option build-in to restic.

Do you know if there is a feature board for restic where we can vote for features on the roadmap?

1 Like

I have never heard/seen of a feature board for restic.

We currently use thumbs-up at the corresponding Github issues, see Issues · restic/restic · GitHub . But adding those features only progresses very slowly.

1 Like