Does anyone have have a script to check when a RAID-rebuild is done and then execute a command?

I am checking the status of `/proc/mdadm` and when the `resync` is done, it should execute a command that notifies the user to tell me that its done.

I'm not sure what loop is the best to check when the RAID is done rebuilding and I found no such script on the internet.