Simon icon Simon
Flexible server monitoring

Testing TimeMachine

Hi,

Is there a way to test Timemachine activities like :
- Sending an email notification when it starts
- Sending an email notification when it fails
- Sending an email notification when it stops

Thanks for your feedback

David Sinclair's picture

Re: Testing TimeMachine

Hi,

There is a Terminal command to access Time Machine called tmutil. You can read about it via man tmutil in Terminal.

It has some useful variations. One that could be useful for what you want is tmutil latestbackup: that will output the path of the most recent backup. I'm not sure if it'll change when the backup is started or completed, though; you could experiment with that. So you could use a script-based service to look at that, a Change filter to detect any changes, and an email notifier.

I don't see any option to output an error, though maybe tmutil destinationinfo or another might do so.

Hope this helps.

Re: Testing TimeMachine

I'm currently checking when Time Machine backups start and stop using the tmutil status command. Try running this command in Terminal and you'll see Running = 0 or Running = 1.

So you can use this in a shell script counting the number of times Running = 1 appears using grep -c, like so:

tmutil status | grep -c "Running = 1"

Output will be 0 when Time Machine backup is not running, and 1 when it is.