Time Machine notification

I want to make an app that notifies me when Time Machine has successfully & completed backed up my computer though a “display dialog” function maybe???




take a look at TimeMachineGrowler

StefanK’s suggestion is good. However, if you wanted to do it yourself here’s an outline of what I think might work.

  1. I think you could probably use launchd to detect when a backup started. Set the Time Machine folder as a watch folder. When a backup starts I believe launchd would see the change in the watch folder and run a script for you.

  2. once the script starts you would have to disable the launchd plist so you don’t receive more notices.

do shell script "launchctl unload /path/to/plist
  1. now you have to detect when it stopped. I noticed when backing up the process named backupd runs. Prior to backing up, this process (if it exists) uses 0 percent of the cpu. When running the cpu usage ramps up. I would think that you could run a loop checking the cpu usage of backupd. When the process either goes away or the cpu usage goes back to 0 then that would indicate that time machine has stopped. So a simple repeat loop with a delay running the following code would work (or a stay-open applescript). You’ll have to make the code more robust, it’s just an example.
try -- error if the process isn't found
	set theWords to words of (do shell script "/bin/ps -Aco command,%cpu | grep \"backupd\"")
	set cpuUsage to (item 2 of theWords) as real
	if cpuUsage is 0.0 then
		display dialog "Finished!"
		log "still running"
	end if
on error
	display dialog "Finished!"
end try
  1. restart the launchd plist
do shell script "launchctl load /path/to/plist

Ok, thanks guys. I’ll take a look at the time machine app and your code.

I appreciate all your help!!

distnotifications and look for backupd

otherwise youll hammer the system in a poll