Apple - Is there a bash command to check to see if Time Machine has finished backing up?
tmutil status
is the Lion way now that we have a nice tool for this sort of query.
On newer OS, there is an undocumented command tmutil currentphase
that shows the name of the current phase.
You might also start the backup with tmutil startbackup -b
. -b
blocks the command until the backup has finished.
Here's one way - I know it's nowhere near a "proper" solution, but I imagine it would work.
ps ax | grep "/System/Library/CoreServices/backupd.bundle/Contents/Resources/backupd-helper" | grep -v 'grep'
What it does is search the process list for the backupd-helper process, then filters out the grep command itself from showing up. If the command returns > 0 results, the backupd-helper process is still active. If not, the process has ended, and so you might assume it's done.