1

I'd like to exclude specific times where Time Machine should not run. This is so that I can create an off-site backup of the Time Machine backup for disaster recovery purposes. I don't want a TM backup running while making this backup as it may create a copy in an inconsistent state.

I realize there are tools that allow you to do this, but all require you to disable the Apple Time Machine scheduler, which I prefer to not to do. I'd also prefer not to install software I do not know or trust. Therefore, I'm looking for a command line solution to prevent Time Machine backups from occurring from 12AM to 6AM.

I took a look at tmutil man pages and didn't see any way of including or excluding run times. However, I did see that one can stopbackup, disable, and enable the service using this utility. So perhaps, there's a way to easily schedule these commands to run at certain times? For example:

Run these commands at 12:00AM:

sudo tmutil disable
sudo tmutil stopbackup

Then turn things back on at 6:00AM:

sudo tmutil enable

I tried using iCal with those commands in an .sh file, but nothing happen. I read about launchd, but I'm out of my comfort zone with getting that going, especially since these need to run as root.

2
  • 1
    You can control Time Machine from the command line using tmutil. I did a man tmutil but saw nothing about setting times. You could define a time that excludes certain times. You can tell Time Machine to work between 0:00 to 23:00. This will exclude 23:00-0:00
    – Natsfan
    Jun 21, 2018 at 15:53
  • Thanks @jmh, would you mind posting an answer that shows me how to "define a time that excludes certain times"? I'd be happy to accept it. Jun 21, 2018 at 16:34

1 Answer 1

1

There is no option to exclude certain times but there is an option to define times to run a backup. If you want to exclude working hours, 9 am to 6 pm, for example, you could tell Time Machine to make a backup between 18:00 hours to 9:00 (6 pm to 9 am). Forcing Time Machine to these hours essentially excludes your window.

6
  • Thanks. So how does one do this? Is it via Terminal Command? Do you know what the Terminal Command is? Jun 21, 2018 at 18:08
  • Sure I know what terminal command is. I mentioned earlier that the man page for tmutil mentioned nothing about time windows.
    – Natsfan
    Jun 21, 2018 at 19:02
  • 1
    I use TimeMachineEditor.app which does allow you to input exclusion times. This 3rd party app is available here: tclementdev.com/timemachineeditor
    – Natsfan
    Jun 21, 2018 at 19:16
  • No, you misunderstand. What is the Terminal command I need to type to set the Time Machine backup schedule as you suggested is possible. As I pointed out, I don't want to use a 3rd party tool. Jun 22, 2018 at 3:03
  • I said the tmutil man page makes no mention of time windows. My answer referred to the 3rd party app.
    – Natsfan
    Jun 22, 2018 at 14:21

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .