Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!


Click here to return to the 'Time Machine: Mount backup disk on demand' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Time Machine: Mount backup disk on demand
Authored by: syzygies on Jul 25, '10 08:57:02PM

The test that Time Machine has finished needs to be fixed:

return do("ps -ax | grep [b]ackupd >>'%s' 2>&1" % logfile)
will always return false, because the (recently added) logging steals any true response. Because of the delay before backupd-helper returns, and the scripted sleeps, this only affects longer backups, but it needs to be changed.

Instead, one can write

return do("ps -ax | grep [b]ackupd | tee -a '%s'" % logfile)
or following a suggestion in the comments,
return not do("grep backupd /var/log/system.log | tail -1 | grep successfully")
I have tested both variants extensively before posting here. The second depends on a sufficient delay to allow Time Machine to start up, so one doesn't end up reading the previous success message for that day.

The first is more conservative; backupd will continue to run for several minutes after the success message is written to the system log, and if one unmounts the Time Machine volume during this period, one sees the further message

Stopping backupd to allow ejection of backup destination disk!
However, the backup appears to be successful. So this is a matter of taste and temperament; do you prefer to have the Time Machine volume unmount as soon as possible, and are willing to have these messages appear in the system log?

In general, with any script like this, one needs to determine if it is running correctly in one's local environment. The acid test of any backup scheme is a successful restore. Short of this, enter Time Machine and see if the expected time periods are present. Look at the folders in the Time Machine volume. And study the system log, using the terminal command

grep backupd /var/log/system.log



[ Reply to This | # ]