Skip to main content

Has anyone been able to write a script using tmutil to set more than one destination?



For example I would like to set either two network destinations or a single network destination and a local HD.



I've got this script running for a single destination, but when I try and modify it to set multiple destinations things don't work.



If I try two scripts one will simply overwrite the other.



Is setting multiple destinations even possible with the current tmutil?



#!/bin/sh

TimeMachineDestination="afp://username:password@server.pretendco.com/Backups"

echo "Setting Time Machine Destination"

/usr/bin/tmutil setdestination $TimeMachineDestination

echo "Enabling Time Machine"

/usr/bin/tmutil enable

exit 0

Try the -a flag to set the 2nd destination.



#!/bin/sh

TimeMachineDestination1="afp://username:password@server1.pretendco.com/Backups"
TimeMachineDestination2="afp://username:password@server2.pretendco.com/Backups"

echo "Setting Time Machine Destination"

/usr/bin/tmutil setdestination $TimeMachineDestination1
/usr/bin/tmutil setdestination -a $TimeMachineDestination2

echo "Enabling Time Machine"

/usr/bin/tmutil enable

exit 0

Major edit:



Ugh it helps if one uses the -a argument in the right place. ;-)